home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 3 / CD ACTUAL 3.iso / linux / docs / linux-do / network- / nag-1.0 / nag-1 / nag.ascii < prev    next >
Encoding:
Text File  |  1994-08-18  |  860.2 KB  |  26,212 lines

  1.  
  2.  
  3.  
  4.                                   - 1 -
  5.  
  6.  
  7.  
  8.       The Linux Network Administrators' Guide
  9.       ------------------------------------------------------------------------
  10.       Copyright (C) 1992-1994                                       Olaf Kirch
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                                   - 2 -
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                                   - 3 -
  137.  
  138.  
  139.  
  140.       For Britta
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                                   - 4 -
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                                   - 5 -
  269.  
  270.  
  271.  
  272.       Legal Notice
  273.  
  274.  
  275.       UNIX is a trademark of Univel.
  276.       Linux is not a trademark, and has no connection to UNIX(tm) or Univel.
  277.  
  278.  
  279.  
  280.       Copyright (C) 1994  Olaf Kirch
  281.       Kattreinstr. 38, 64295 Darmstadt, Germany
  282.       okir@monad.swb.de
  283.  
  284.  
  285.  
  286.       ``The  Linux  Network Administrators' Guide'' may be reproduced and dis-
  287.       tributed in whole or in part, subject to the following conditions:
  288.  
  289.  
  290.  
  291.  
  292.        01.  The copyright notice above and this permission notice must be pre-
  293.             served complete on all complete or partial copies.
  294.  
  295.  
  296.        02.  Any translation or derivative work of ``The Linux Network Adminis-
  297.             trators' Guide'' must be approved by the author in writing  before
  298.             distribution.
  299.  
  300.  
  301.        03.  If  you  distribute ``The Linux Network Administrators' Guide'' in
  302.             part, instructions for obtaining the  complete  version  of  ``The
  303.             Linux  Network  Administrators'  Guide''  must  be included, and a
  304.             means for obtaining a complete version provided.
  305.  
  306.  
  307.        04.  Small portions may be reproduced as illustrations for  reviews  or
  308.             quotes in other works without this permission notice if proper ci-
  309.             tation is given.
  310.  
  311.  
  312.        05.  If you print and distribute ``The  Linux  Network  Administrators'
  313.             Guide'',  you  may  not refer to it as the ``Official Printed Ver-
  314.             sion''.
  315.  
  316.  
  317.        06.  The GNU General Public License referenced below may be  reproduced
  318.             under the conditions given within it.
  319.  
  320.  
  321.        07.  Several  sections  of  this document are held under separate copy-
  322.             right.  When these sections are covered by a different  copyright,
  323.             the  seperate  copyright  is noted.  If you distribute ``The Linux
  324.             Network Administrators' Guide'' in part,  and  that  part  is,  in
  325.             whole,  covered  under a seperate, noted copyright, the conditions
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                                   - 6 -
  335.  
  336.  
  337.  
  338.             of that copyright apply.
  339.  
  340.  
  341.  
  342.            Exceptions to these rules may be  granted  for  academic  purposes:
  343.       Write  to  Olaf  Kirch at the above address, or email okir@monad.swb.de,
  344.       and ask.  These restrictions are here to protect us as authors,  not  to
  345.       restrict you as educators and learners.
  346.  
  347.  
  348.  
  349.       All source code in ``The Linux Network Administrators' Guide'' is placed
  350.       under the GNU General Public License.  See appendix 20.3 for a  copy  of
  351.       the GNU ``GPL.''
  352.  
  353.  
  354.            The  author  is not liable for any damages, direct or indirect, re-
  355.       sulting from the use of information provided in this document.
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                                   - 7 -
  401.  
  402.  
  403.  
  404.       Preface
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.            With the Internet much of a buzzword recently, and otherwise  seri-
  418.       ous  people joyriding along the ``Informational Superhighway,'' computer
  419.       networking seems to be moving toward the status of TV sets and microwave
  420.       ovens.  The  Internet is recently getting an unusually high media cover-
  421.       age, and social science majors are descending on  Usenet  newsgroups  to
  422.       conduct  researches  on the ``Internet Culture.''  Carrier companies are
  423.       working to introduce new transmission techniques  like  ATM  that  offer
  424.       many times the bandwidth the average network link of today has.
  425.  
  426.  
  427.            Of  course, networking has been around for a long time.  Connecting
  428.       computers to form local area networks has been common practice  even  at
  429.       small installations, and so have been long-haul links using public tele-
  430.       phone lines. A rapidly growing conglomerate of world-wide networks  has,
  431.       however,  made joining the global village a viable option even for small
  432.       non-profit organizations of private computer users. Setting up an Inter-
  433.       net  host  with  mail  and news capabilities offering dial-up access has
  434.       become affordable, and the advent of ISDN  will  doubtlessly  accelerate
  435.       this trend.
  436.  
  437.  
  438.            Talking  of  computer networks quite frequently means talking about
  439.       UNIX. Of course, UNIX is neither the only operating system with  network
  440.       capabilities, nor will it remain a front-runner forever, but it has been
  441.       in the networking business for a long time, and will surely continue  to
  442.       do so for some time to come.
  443.  
  444.  
  445.            What  makes  it  particularly  interesting to private users is that
  446.       there has been much activity to bring free UNIXoid operating systems  to
  447.       the  PC,  being  386BSD,  FreeBSD  --- and Linux.  However, Linux is not
  448.       UNIX. That is a registered trademark  of  whoever  currently  holds  the
  449.       rights  to it (Univel, while I'm typing this), while Linux is an operat-
  450.       ing system that strives to offer all functionality the  POSIX  standards
  451.       require for UNIX-like operating systems, but is a complete reimplementa-
  452.       tion.
  453.  
  454.  
  455.            The Linux kernel was written largely by Linus Torvalds, who started
  456.       it  as a project to get to know the Intel i386, and to ``make MINIX bet-
  457.       ter.'' MINIX was then another popular PC operating system offering vital
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                                   - 8 -
  467.  
  468.  
  469.  
  470.       ingredients  of  Un*x functionality, and was written by Prof.  Andrew S.
  471.       Tanenbaum.
  472.  
  473.  
  474.            Linux is covered by the GNU General  Public  License  (GPL),  which
  475.       allows  free  distribution  of the code (please read the GPL in appendix
  476.       20.3 for a definition of what ``free software'' means).  Outgrowing  its
  477.       child's diseases, and drawing from a large and ever-growing base of free
  478.       application programs, it is quickly  becoming  the  oprating  system  of
  479.       choice  for  many  PC owners.  The kernel and C library have become that
  480.       good that most standard software may be compiled  with  no  more  effort
  481.       than  is  required  on  any other mainstream Un*xish system, and a broad
  482.       assortment of packaged Linux distributions allows you to almost drop  it
  483.       onto your hard disk and start playing.
  484.  
  485.  
  486.       Documentation on Linux
  487.  
  488.  
  489.  
  490.  
  491.            One  of  the  complaints that are frequently levelled at Linux (and
  492.       free software in general) is the sorry state or complete lack  of  docu-
  493.       mentation.  In  the  early days it was not unusual for a package to come
  494.       with a handful of READMEs and installation notes. They gave  the  moder-
  495.       ately experienced Un*x wizard enough information to successfully install
  496.       and run it, but left the average newbie out in the cold.
  497.  
  498.  
  499.            Back in late 1992, Lars Wirzenius and Michael K. Johnson  suggested
  500.       to form the Linux Documentation Project, or LDP, which aims at providing
  501.       a coherent set of manuals.  Stopping short of answering  questions  like
  502.       ``How?'',  or  ``Why?'',  or ``What's the meaning of life, universe, and
  503.       all the rest?'', these manuals attempt to cover most aspects of  running
  504.       and using a Linux system users without requiring a prior degree in Un*x.
  505.  
  506.  
  507.            Among the achievements of the LDP are the Installation and  Getting
  508.       Started  Guide,  written  by  Matt  Welsh,  the Kernel Hacker's Guide by
  509.       Michael K. Johnson, and the manpage project coordinated  by  Rik  Faith,
  510.       which  so far supplied a set of roughly 450 manual pages for most system
  511.       and C library calls.  The System Administrators' Guide, written by  Lars
  512.       Wirzenius,  is  still  at the Alpha stage.  A User's Guide is being pre-
  513.       pared.
  514.  
  515.  
  516.            This book, the Linux Network Administrators' Guide, is part of  the
  517.       LDP  series, too. As such, it may be copied and distributed freely under
  518.       the LDP copying license which is reproduced on the second page.
  519.  
  520.  
  521.             However, the LDP books are not the only source of  information  on
  522.       Linux. At the moment, there are more than a dozen HOWTOs that are posted
  523.       to comp.os.linux.announce regularly and archived at various  FTP  sites.
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                                   - 9 -
  533.  
  534.  
  535.  
  536.       HOWTOs  are  short documents of a few pages that give you a brief intro-
  537.       duction into topics such as Ethernet support under Linux, or the config-
  538.       uration  of Usenet news software, and answer frequently asked questions.
  539.       They usually provide the most accurate and up-to-date information avali-
  540.       able on the topic. A list of available HOWTOs is produced in the ``Anno-
  541.       tated Bibliography'' toward the end of this book.
  542.  
  543.  
  544.       About This Book
  545.  
  546.       When I joined the Linux Documentation Project in 1992, I wrote two small
  547.       chapters  on  UUCP  and smail, which I meant to contribute to the System
  548.       Administrator's Guide. Development of TCP/IP networking was just  begin-
  549.       ning,  and  when  those  ``small  chapters'' started to grow, I wondered
  550.       aloud if it wouldn't be nice to have  a  Networking  Guide.   ``Great'',
  551.       everyone  said,  ``I'd  say,  go for it!'' So I went for it, and wrote a
  552.       first version of the Networking Guide, which  I  released  in  September
  553.       1993.
  554.  
  555.  
  556.            The  new  Networking  Guide you are reading right now is a complete
  557.       rewrite that features several new applications that have  become  avail-
  558.       able to Linux users since the first release.
  559.  
  560.  
  561.            The  book is organized roughly in the sequence of steps you have to
  562.       take to configure your system for networking. It  starts  by  discussing
  563.       basic concepts of networks, and TCP/IP-based networks in particular.  We
  564.       then slowly work our way up from configuring TCP/IP at the device  level
  565.       to the setup of common applications such as rlogin and friends, the Net-
  566.       work File System, and the Network Information System.  This is  followed
  567.       by a chapter on how to set up your machine as a UUCP node. The remainder
  568.       of the book is dedicated to two major applications that run  on  top  of
  569.       both TCP/IP and UUCP: electronic mail and news.
  570.  
  571.  
  572.            The  email part features an introduction of the more intimate parts
  573.       of mail transport and routing, and the myriads of addressing schemes you
  574.       may be confronted with. It describes the configuration and management of
  575.       smail, a mail transport agent commonly used on smaller  mail  hubs,  and
  576.       sendmail,  which  is for people who have to do more complicated routing,
  577.       or have to handle a large volume of mail. The sendmail chapter has  been
  578.       written and contributed by Vince Skahan.
  579.  
  580.  
  581.            The  news  part attempts to give you an overview of how Usenet news
  582.       works, covers C news, the most widely used news  transport  software  at
  583.       the moment, and the use of NNTP to provide newsreading access to a local
  584.       network. The book closes with a short chapter on the care and feeding of
  585.       the most popular newsreaders on Linux.
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                                  - 10 -
  599.  
  600.  
  601.  
  602.       The Official Printed Version
  603.  
  604.       In autumn 1993, Andy Oram, who has been around the LDP mailing list from
  605.       almost the very beginning, asked me about publishing my book at O'Reilly
  606.       and  Associates.  I was excited about this; I had never imagined my book
  607.       being that successful. We finally agreed that O'Reilly would produce  an
  608.       enhanced Official Printed Version of the Networking Guide with me, while
  609.       I retained the original copyright so that the source of the  book  could
  610.       be freely distributed.(1) This means that you can choose freely: you can
  611.       get  the LaTeXsource distributed on the network (or the preformatted DVI
  612.       or PostScript versions, for that matter), and print it out. Or  you  can
  613.       purchase  the  official  printed  version  from  O'Reilly, which will be
  614.       available some time later this year.
  615.  
  616.  
  617.            Then, why would you want to pay money for something you can get for
  618.       free?  Is Tim O'Reilly out of his mind for publishing something everyone
  619.       can  print  and even sell herself?(2) Or is there any difference between
  620.       these versions?
  621.  
  622.  
  623.            The answers are ``it depends,'' ``no, definitely not,''  and  ``yes
  624.       and  no.'' O'Reilly and Associates do take a risk in publishing the Net-
  625.       working Guide, but I hope it will finally pay off for them. If it  does,
  626.       I  believe  this  project  can serve as an example how the free software
  627.       world and companies can cooperate  to  produce  something  both  benefit
  628.       from.  In my view, the great service O'Reilly is doing to the Linux com-
  629.       munity (apart from the book being readily available in your local  book-
  630.       store)  is  that  it  may help Linux being recognized as something to be
  631.       taken seriously: a viable and useful alternative to commercial  PC  UNIX
  632.       operating systems.
  633.  
  634.  
  635.            So  what  about the differences between the printed version and the
  636.       online one?  Andy Oram has made great efforts at transforming  my  early
  637.       ramblings  into  something  actually  worth printing.  (He has also been
  638.       reviewing the other books put out by the  Linux  Documentation  Project,
  639.       trying  to  contribute  whatever professional skills he can to the Linux
  640.       community.)
  641.  
  642.  
  643.            Since Andy started reviewing the Networking Guide and  editing  the
  644.       copies  I sent him, the book has improved vastly over what it was half a
  645.       year ago. It would be nowhere close to where it is now without his  con-
  646.       tributions.   All  his  edits have been fed back into online version, as
  647.       will any changes that will be made to the Networking  Guide  during  the
  648.       copy-editing  phase  at  O'Reilly.   So  there  will be no difference in
  649.  
  650.       
  651.  
  652.       1. The   copyright   notice   is   reproduced  on  the  page
  653.          immediately following the title page.
  654.       2. Note that while you are allowed to print out  the  online
  655.          version,  you  may  not  run  the O'Reilly book through a
  656.          photocopier,  and   much   less   sell   any   of   those
  657.          (hypothetical) copies.
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.                                  - 11 -
  666.  
  667.  
  668.  
  669.       content.  Still, the O'Reilly version will be different:  On  one  hand,
  670.       people  at  O'Reilly  are  putting a lot of work into the look and feel,
  671.       producing a much more pleasant layout than you could  ever  get  out  of
  672.       standard  LaTeX. On the other hand, it will feature a couple of enhance-
  673.       ments like an improved index, and better and more figures.
  674.  
  675.  
  676.       More Information
  677.  
  678.       If you follow the instructions in this book, and something does not work
  679.       nevertheless,  please  be  patient.  Some of your problems may be due to
  680.       stupid mistakes on my part, but may also be caused  by  changes  in  the
  681.       networking   software.    Therefore,   you   should   probably   ask  on
  682.       comp.os.linux.help first. There's a good chance that you are  not  alone
  683.       with  your  problems, so that a fix or at least a proposed workaround is
  684.       likely to be known. If you have the opportunity, you should also try  to
  685.       get  the  latest  kernel  and  network release from one of the Linux FTP
  686.       sites, or a BBS near you.  Many problems are  caused  by  software  from
  687.       different  stages  of development, which fail to work together properly.
  688.       After all, Linux is ``work in progress''.
  689.  
  690.  
  691.             Another good place to inform yourself about current development is
  692.       the Networking HOWTO. It is maintained by Terry Dawson(3) . It is posted
  693.       to comp.os.linux.announce once a month, and contains the most up-to-date
  694.       information.  The current version can also be  obtained  (among  others)
  695.       from  tsx-11.mit.edu, in /pub/linux/doc. For problems you can't solve in
  696.       any other way, you may also contact the  author  of  this  book  at  the
  697.       address  given  in  the  preface.  However,  please, refrain from asking
  698.       developers for help.  They are already devoting a major  part  of  their
  699.       spare time to Linux anyway, and occasionally even have a life beyond the
  700.       net:-)
  701.  
  702.  
  703.       On the Authors
  704.  
  705.       Olaf has been a UNIX user and part-time administrator for  a  couple  of
  706.       years while he was studying mathematics.  At the moment, he's working as
  707.       a UNIX programmer and is writing a book.  One of his favorite sports  is
  708.       doing  things  with  sed  that  other  people would reach for their perl
  709.       interpreter for.  He has about as much fun with this  as  with  mountain
  710.       hiking with a backpack and a tent.
  711.  
  712.  
  713.            Vince  Skahan  has been administering large numbers of UNIX systems
  714.       since 1987 and currently runs sendmail+IDA  on  approximately  300  UNIX
  715.       workstations  for  over  2000  users.   He admits to losing considerable
  716.       sleep from editing quite a few sendmail.cf files `the hard  way'  before
  717.       discovering  sendmail+IDA in 1990.  He also admits to anxiously awaiting
  718.       the delivery of the first perl-based version of sendmail for  even  more
  719.       obscure fun(4) ...
  720.  
  721.       
  722.  
  723.       3. Terry Dawson can be reached at terryd@extro.ucc.su.oz.au.
  724.       4. Don't you think we could do it with sed, Vince?
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.                                  - 12 -
  733.  
  734.  
  735.  
  736.            Olaf can be reached at the following address:
  737.  
  738.  
  739.            Olaf Kirch
  740.            Kattreinstr. 38
  741.            64295 Darmstadt
  742.            Germany
  743.            okir@monad.swb.de
  744.  
  745.  
  746.  
  747.            Vince can be reached at:
  748.  
  749.  
  750.            Vince Skahan
  751.            vince@victrola.wa.com
  752.  
  753.  
  754.  
  755.            We are open to your questions, comments, postcards, etc.   However,
  756.       we ask you not to telephone us unless it's really important.
  757.  
  758.  
  759.       Thanks
  760.  
  761.       Olaf  says: This book owes very much to the numerous people who took the
  762.       time to proofread it and helped iron out many mistakes,  both  technical
  763.       and grammatical (never knew that there's such a thing as a dangling par-
  764.       ticiple).  The most vigorous among them was Andy Oram  at  O'Reilly  and
  765.       Associates.
  766.  
  767.  
  768.            I  am  greatly  indebted  to  Andres  Seplveda, Wolfgang Michaelis,
  769.       Michael K. Johnson, and all developers who spared the time to check  the
  770.       information  provided  in the Networking Guide. I also wish to thank all
  771.       those who read the first version of the Networking  Guide  and  sent  me
  772.       corrections  and  suggestions.  You  can find hopefully complete list of
  773.       contributors in the file Thanks in the  online  distribution.   Finally,
  774.       this  book  would  not  have been possible without the support of Holger
  775.       Grothe, who provided me with the critical Internet connectivity.
  776.  
  777.  
  778.            I would also like to thank the following groups and  companies  who
  779.       printed the first edition of the Networking Guide and have donated money
  780.       either to me, or to the Linux Documentation Project as a whole.
  781.  
  782.  
  783.  
  784.  
  785.               + Linux Support Team, Erlangen, Germany
  786.  
  787.               + S.u.S.E. GmbH, Fuerth, Germany
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.                                  - 13 -
  799.  
  800.  
  801.  
  802.               + Linux System Labs, Inc., United States
  803.  
  804.  
  805.  
  806.            Vince says: Thanks go to Neil Rickert and Paul Pomes  for  lots  of
  807.       help  over  the years regarding the care and feeding of sendmail+IDA and
  808.       to Rich Braun for doing the initial port of sendmail+IDA to Linux.   The
  809.       biggest  thanks  by  far go to my wife Susan for all the support on this
  810.       and other projects.
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.                                  - 14 -
  865.  
  866.  
  867.  
  868.       Typographical Conventions
  869.  
  870.       In writing  this  book,  a  number  of  typographical  conventions  were
  871.       employed  to  mark  shell  commands,  variable  arguments, etc. They are
  872.       explained below.
  873.  
  874.  
  875.  
  876.  
  877.       Bold Font Used to mark hostnames and mail addresses, as well as new con-
  878.                 cepts and warnings.
  879.  
  880.  
  881.       Italics Font Used  to  mark  file  names, UNIX commands, and keywords in
  882.                 configuration files. Also used for emphasis in text.
  883.  
  884.  
  885.       Typewriter Font Used to  represent  screen  interaction,  such  as  user
  886.                 interaction when running a program.
  887.  
  888.  
  889.                      Also  used  for code examples, whether it is a configura-
  890.                 tion file, a shell script, or something else.
  891.  
  892.  
  893.       Typewriter Slanted Font Used to mark meta-variables in the  text,  espe-
  894.                 cially in representations of the command line.  For example,
  895.  
  896.  
  897.                      $ ls -l foo
  898.  
  899.  
  900.  
  901.  
  902.                      where foo would ``stand for'' a filename, such as /tmp.
  903.  
  904.  
  905.           `Key' Represents  a  key  to  press.   You will often see it in this
  906.                 form:
  907.  
  908.  
  909.                      Press `return' to continue.
  910.  
  911.  
  912.  
  913.              <> A diamond in the margin, like a black diamond on a  ski  hill,
  914.                 marks  ``danger'' or ``caution.''  Read paragraphs marked this
  915.                 way carefully.
  916.  
  917.  
  918.         $ and # When preceding a shell command to be typed, these  denote  the
  919.                 shell  prompt.  The `$' symbol is used when the command may be
  920.                 executed as a normal user; `#' means that the command requires
  921.                 super user privilieges.
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.                                  - 15 -
  931.  
  932.  
  933.  
  934.       The Linux Documentation Project
  935.  
  936.  
  937.  
  938.  
  939.            The  Linux  Documentation Project, or LDP, is a loose team of writ-
  940.       ers, proofreaders, and editors who are working together to provide  com-
  941.       plete documentation for the Linux operating system.  The overall coordi-
  942.       nator of the project is Matt Welsh, who is heavily aided by Lars  Wirze-
  943.       nius and Michael K. Johnson.
  944.  
  945.  
  946.            This  manual  is  one  in a set of several being distributed by the
  947.       LDP, including a Linux Users' Guide, System Administrators' Guide,  Net-
  948.       work Administrators' Guide, and Kernel Hackers' Guide. These manuals are
  949.       all available in LaTeX source format, .dvi format, and postscript output
  950.       by    anonymous    FTP    from    nic.funet.fi,    in    the   directory
  951.       /pub/OS/Linux/doc/doc-project, and from tsx-11.mit.edu, in the directory
  952.       /pub/linux/docs/guides.
  953.  
  954.  
  955.            We  encourage anyone with a penchant for writing or editing to join
  956.       us in improving Linux documentation. If you have Internet e-mail access,
  957.       you  can  join  the  DOC  channel of the Linux-Activists mailing list by
  958.       sending mail to
  959.  
  960.  
  961.            linux-activists-request@niksula.hut.fi
  962.  
  963.  
  964.  
  965.  
  966.       with the line
  967.  
  968.  
  969.            X-Mn-Admin: join DOC
  970.  
  971.  
  972.  
  973.  
  974.       in the header or as the first line of the message body.  An  empty  mail
  975.       without  the  additional  header line will make the mail-server return a
  976.       help message. To leave the channel, send a message to the same  address,
  977.       including the line
  978.  
  979.  
  980.            X-Mn-Admin: leave DOC
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.                                  - 16 -
  997.  
  998.  
  999.  
  1000.       Filesystem Standards
  1001.  
  1002.  
  1003.  
  1004.  
  1005.            Throughout  the past, one of the problems that afflicted Linux dis-
  1006.       tributions as well as separate packages was that  there  was  no  single
  1007.       accepted  file system layout. This resulted in incompatibilities between
  1008.       different packages, and confronted users and administrators  alike  with
  1009.       the task to locate various files and programs.
  1010.  
  1011.  
  1012.            To  improve  this  situation, in August 1993, several people formed
  1013.       the Linux File System Standard Group, or FSSTND Group for short, coordi-
  1014.       nated  by Daniel Quinlan. After six months of discussion, the group pre-
  1015.       sented a draft that presents a coherent file sytem structure and defines
  1016.       the location of most essential programs and configuration files.
  1017.  
  1018.  
  1019.            This  standard  is  supposed  to be implemented by most major Linux
  1020.       distributions and packages. Throughout  this  book,  we  will  therefore
  1021.       assume  that any files discussed reside in the location specified by the
  1022.       standard; only where there is a long tradition that conflicts with  this
  1023.       specification will alternative locations be mentioned.
  1024.  
  1025.  
  1026.            The Linux File System Standard can be obtained from all major Linux
  1027.       FTP sites and their mirrors; for instance,  you  can  find  it  on  sun-
  1028.       site.unc.edu  below  /pub/linux/docs. Daniel Quinlan, the coordinator of
  1029.       the FSSTND group can be reached at quinlan@bucknell.edu.
  1030.  
  1031.  
  1032.            1ex
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.                                  - 17 -
  1063.  
  1064.  
  1065.  
  1066.       2.  Introduction to Networking
  1067.  
  1068.       2.1  History
  1069.  
  1070.  
  1071.  
  1072.  
  1073.            The idea of networking is probably  as  old  as  telecommunications
  1074.       itself.   Consider  people living in the stone age, where drums may have
  1075.       been used to transmit messages between individuals.  Suppose  caveman  A
  1076.       wants to invite caveman B for a game of hurling rocks at each other, but
  1077.       they live too far apart for B to hear A banging his drum.  So  what  are
  1078.       A's  options?  He could 1) walk over to B's place, 2) get a bigger drum,
  1079.       or 3) ask C, who lives halfway between them, to forward the message. The
  1080.       last is called networking.
  1081.  
  1082.  
  1083.            Of  course, we have come a long way from the primitive pursuits and
  1084.       devices of our forebears. Nowadays, we have computers talk to each other
  1085.       over  vast assemblages of wires, fiber optics, microwaves, and the like,
  1086.       to make an appointment for saturday's soccer match.(1) In the following,
  1087.       we will deal with the means and ways by which this is accomplished,  but
  1088.       leave out the wires, as well as the soccer part.
  1089.  
  1090.  
  1091.            We  will  describe two types of networks in this guide: those based
  1092.       on UUCP, and those based on TCP/IP. These are protocol suites and  soft-
  1093.       ware packages that supply means to transport data between two computers.
  1094.       In this chapter, we will look at both types  of  networks,  and  discuss
  1095.       their underlying principles.
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.            We  define a network as a collection of hosts that are able to com-
  1102.       municate with each other, often by relying on the services of  a  number
  1103.       of  dedicated hosts that relay data between the participants.  Hosts are
  1104.       very often computers, but need not be; one can also think of X-terminals
  1105.       or intelligent printers as hosts. Small agglomerations of hosts are also
  1106.       called sites.
  1107.  
  1108.  
  1109.             Communication is impossible without some sort of language or code.
  1110.       In  computer  networks,  these languages are collectively referred to as
  1111.       protocols. However, you shouldn't think of written protocols  here,  but
  1112.       rather  of the highly formalized code of behavior observed when heads of
  1113.       state meet, for instance.  In a very similar fashion, the protocols used
  1114.       in  computer networks are nothing but very strict rules for the exchange
  1115.       of messages between two or more hosts.
  1116.  
  1117.  
  1118.       
  1119.  
  1120.       1. The original spirit of which (see above) still  shows  on
  1121.          some occasions in Europe.
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.                                  - 18 -
  1130.  
  1131.  
  1132.  
  1133.       2.2  UUCP Networks
  1134.  
  1135.  
  1136.  
  1137.  
  1138.            UUCP is an abbreviation for Unix-to-Unix Copy. It started out as  a
  1139.       package  of programs to transfer files over serial lines, schedule those
  1140.       transfers, and initiate execution of programs on remote  sites.  It  has
  1141.       undergone  major changes since its first implementation in the late sev-
  1142.       enties, but is still rather spartan in the services it offers. Its  main
  1143.       application  is  still  in wide-area networks based on dial-up telephone
  1144.       links.
  1145.  
  1146.  
  1147.            UUCP was first developed by Bell Laboratories in 1977 for  communi-
  1148.       cation  between  their Unix-development sites. In mid-1978, this network
  1149.       already connected over 80 sites.  It was running email  as  an  applica-
  1150.       tion, as well as remote printing.  However, the system's central use was
  1151.       in distributing new software and bugfixes.(2) Today, UUCP  is  not  con-
  1152.       fined  to  the Un*x environment anymore. There are both free and commer-
  1153.       cial ports available for a variety of platforms, including AmigaOS, DOS,
  1154.       Atari's TOS, etc.
  1155.  
  1156.  
  1157.            One  of  the main disadvantages of UUCP networks is their low band-
  1158.       width.  On one hand, telephone equipment places a  tight  limit  on  the
  1159.       maximum  transfer  rate. On the other hand, UUCP links are rarely perma-
  1160.       nent connections; instead, hosts rather dial up each  other  at  regular
  1161.       intervals.  Hence,  most of the time it takes a mail message to travel a
  1162.       UUCP network it sits idly on some host's disk, awaiting the next time  a
  1163.       connection is established.
  1164.  
  1165.  
  1166.            Despite these limitations, there are still many UUCP networks oper-
  1167.       ating all over the world, run mainly by hobbyists, which  offer  private
  1168.       users network access at reasonable prices.  The main reason for the pop-
  1169.       ularity of UUCP is that it is dirt cheap compared to  having  your  com-
  1170.       puter connected to The Big Internet Cable.  To make your computer a UUCP
  1171.       node, all you need is  a  modem,  a  working  UUCP  implementation,  and
  1172.       another UUCP node that is willing to feed you mail and news.
  1173.  
  1174.  
  1175.       2.2.1  How to Use UUCP
  1176.  
  1177.       The  idea  behind UUCP is rather simple: as its name indicates, it basi-
  1178.       cally copies files from one host to another, but it also allows  certain
  1179.       actions to be performed on the remote host.
  1180.  
  1181.  
  1182.              Suppose  your  machine  is  allowed to access a hypothetical host
  1183.       named swim, and have it execute the lpr print command for you.  Then you
  1184.       could  type the following on your command line to have this book printed
  1185.  
  1186.       
  1187.  
  1188.       2. Not that the times had changed that much...
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.                                  - 19 -
  1197.  
  1198.  
  1199.  
  1200.       on swim:(3)
  1201.  
  1202.  
  1203.            $ uux -r swim!lpr !netguide.dvi
  1204.  
  1205.  
  1206.  
  1207.  
  1208.            This makes uux, a command from the UUCP suite, schedule a  job  for
  1209.       swim. This job consists of the input file, netguide.dvi, and the request
  1210.       to feed this file to lpr.  The -r flag tells uux not to call the  remote
  1211.       system  immediately, but to rather store the job away until a connection
  1212.       is established at a later occasion. This is called spooling.
  1213.  
  1214.  
  1215.             Another property of UUCP is that it allows  to  forward  jobs  and
  1216.       files  through  several hosts, provided they cooperate. Assume that swim
  1217.       from the above examples has a UUCP link with groucho, which maintains  a
  1218.       large  archive  of  Un*x  applications.   To  download  the  file  trip-
  1219.       wire-1.0.tar.gz to your site, you might issue
  1220.  
  1221.  
  1222.            $  uucp  -mr  swim!groucho!~/security/tripwire-1.0.tar.gz
  1223.            trip.tgz
  1224.  
  1225.  
  1226.  
  1227.  
  1228.              The job created will request swim to fetch the file from groucho,
  1229.       and send it to your site, where UUCP  will  store  it  in  trip.tgz  and
  1230.       notify  you  via mail of the file's arrival.  This will be done in three
  1231.       steps. First, your site sends the job to  swim.  When  swim  establishes
  1232.       contact  with  groucho  the  next time, it downloads the file. The final
  1233.       step is the actual transfer from swim to your host.
  1234.  
  1235.  
  1236.            The most important services provided by UUCP  networks  these  days
  1237.       are  electronic  mail  and news. We will come back to these later, so we
  1238.       will give only a brief introduction here.
  1239.  
  1240.  
  1241.            Electronic mail -- email for short -- allows you to  exchange  mes-
  1242.       sages  with users on remote hosts without actually having to know how to
  1243.       access these hosts. The task of directing a message from  your  site  to
  1244.       the  destination site is performed entirely by the mail handling system.
  1245.       In a UUCP environment, mail is  usually  transported  by  executing  the
  1246.       rmail  command  on  a neighboring host, passing it the recipient address
  1247.       and the mail message. rmail will then forward  the  message  to  another
  1248.       host,  and so on, until it reaches the destination host. We will look at
  1249.       this in detail in chapter 14..
  1250.  
  1251.       
  1252.  
  1253.       3. When using bash, the GNU Bourne Again  Shell,  you  might
  1254.          have  to  escape the exclamation mark, because it uses it
  1255.          as its history character.
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.                                  - 20 -
  1264.  
  1265.  
  1266.  
  1267.            News may best be described as sort of a distributed bulletin  board
  1268.       system. Most often, this term refers to Usenet News, which is by far the
  1269.       most widely known news exchange network  with  an  estimated  number  of
  1270.       120,000  participating  sites.  The origins of Usenet date back to 1979,
  1271.       when, after the release of UUCP with the new  Unix  V7,  three  graduate
  1272.       students  had the idea of a general information exchange within the Unix
  1273.       community. They put together some scripts, which became the  first  net-
  1274.       news  system. In 1980, this network connected duke, unc, and phs, at two
  1275.       Universities in North Carolina.  Out of this,  Usenet  eventually  grew.
  1276.       Although it originated as a UUCP-based network, it is no longer confined
  1277.       to one single type of network.
  1278.  
  1279.  
  1280.            The basic unit of information is the article, which may  be  posted
  1281.       to  a  hierarchy  of newsgroups dedicated to specific topics. Most sites
  1282.       receive only a selection of all newsgroups, which carry  an  average  of
  1283.       60MB worth of articles a day.
  1284.  
  1285.  
  1286.            In  the  UUCP  world,  news is generally sent across a UUCP link by
  1287.       collecting all articles from the groups requested, and packing  them  up
  1288.       in a number of batches. These are sent to the receiving site, where they
  1289.       are fed to the rnews command for unpacking and further processing.
  1290.  
  1291.  
  1292.            Finally, UUCP is also the medium of choice for many dial-up archive
  1293.       sites which offer public access.  You can usually access them by dialing
  1294.       them up with UUCP, logging in as a guest user, and download files from a
  1295.       publicly  accessible  archive  area.  These  guest accounts often have a
  1296.       login name and password of uucp/nuucp or something similar.
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.       2.3  TCP/IP Networks
  1303.  
  1304.  
  1305.  
  1306.  
  1307.            Although UUCP may be a reasonable choice for low-cost dial-up  net-
  1308.       work  links,  there  are  many situations in which its store-and-forward
  1309.       technique proves too inflexible, for  example  in  Local  Area  Networks
  1310.       (LANs).  These are usually made up of a small number of machines located
  1311.       in the same building, or even on the same floor, that are interconnected
  1312.       to provide a homogeneous working environment.  Typically, you would want
  1313.       to share files between these hosts, or run distributed  applications  on
  1314.       different machines.
  1315.  
  1316.  
  1317.             These tasks require a completely different approach to networking.
  1318.       Instead of forwarding entire files along with  a  job  description,  all
  1319.       data is broken up in smaller chunks (packets), which are forwarded imme-
  1320.       diately to the destination host, where they are reassembled.  This  type
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.                                  - 21 -
  1330.  
  1331.  
  1332.  
  1333.       of  network  is  called  a packet-switched network.  Among other things,
  1334.       this allows to run interactive applications over the network.  The  cost
  1335.       of this is, of course, a greatly increased complexity in software.
  1336.  
  1337.  
  1338.            The  solution that Un*x system --- and many non-Un*x sites --- have
  1339.       adopted is known as TCP/IP.  In this section, we will have a look at its
  1340.       underlying concepts.
  1341.  
  1342.  
  1343.       2.3.1  Introduction to TCP/IP-Networks
  1344.  
  1345.  
  1346.  
  1347.  
  1348.            TCP/IP  traces  its  origins  to  a  research project funded by the
  1349.       United States DARPA (Defense Advanced Research Projects Agency) in 1969.
  1350.       This  was an experimental network, the ARPANET, which was converted into
  1351.       an operational one in 1975, after it had proven to be a success.
  1352.  
  1353.  
  1354.             In 1983, the new protocol suite TCP/IP was adopted as a  standard,
  1355.       and  all  hosts  on  the  network were required to use it.  When ARPANET
  1356.       finally grew into the Internet (with ARPANET itself passing out of exis-
  1357.       tence  in  1990),  the  use  of TCP/IP had spread to networks beyond the
  1358.       Internet itself. Most notable are Un*x local area networks, but  in  the
  1359.       advent  of fast digital telephone equipment, such as ISDN, it also has a
  1360.       promising future as a transport for dial-up networks.
  1361.  
  1362.  
  1363.             For something concrete to look at as we discuss TCP/IP  throughout
  1364.       the  following sections, we will consider Groucho Marx University (GMU),
  1365.       situated somewhere in Fredland, as an  example.   Most  departments  run
  1366.       their own local area networks, while some share one, and others run sev-
  1367.       eral of them. They are all interconnected, and are hooked to the  Inter-
  1368.       net through a single high-speed link.
  1369.  
  1370.  
  1371.              Suppose your Linux box is connected to a LAN of Un*x hosts at the
  1372.       Mathematics Department, and its name is erdos. To access a host  at  the
  1373.       Physics Department, say quark, you enter the following command:
  1374.  
  1375.  
  1376.  
  1377.            $ rlogin quark.physics
  1378.            Welcome to the Physics Department at GMU
  1379.            (ttyq2) login:
  1380.  
  1381.  
  1382.  
  1383.  
  1384.            At the prompt, you enter your login  name,  say  andres,  and  your
  1385.       password.  You are then given a shell on quark, to which you can type as
  1386.       if you were sitting at the system's console. After you exit  the  shell,
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.                                  - 22 -
  1396.  
  1397.  
  1398.  
  1399.       you  are  returned to your own machine's prompt.  You have just used one
  1400.       of the instantaneous, interactive  applications  that  TCP/IP  provides:
  1401.       remote login.
  1402.  
  1403.  
  1404.              While  being  logged  into  quark,  you might also want to run an
  1405.       X11-based application, like a function plotting program, or a PostScript
  1406.       previewer.  To  tell  this application that you want to have its windows
  1407.       displayed on your host's screen, you have to set the DISPLAY environment
  1408.       variable:
  1409.  
  1410.  
  1411.            $ export DISPLAY=erdos.maths:0.0
  1412.  
  1413.  
  1414.  
  1415.  
  1416.            If  you  now  start your application, it will contact your X server
  1417.       instead of quark's, and display all its  windows  on  your  screen.   Of
  1418.       course,  this  requires  that you have X11 runnning on erdos.  The point
  1419.       here is that TCP/IP allows quark and erdos to send X11 packets back  and
  1420.       forth  to give you the illusion that you're on a single system. The net-
  1421.       work is almost transparent here.
  1422.  
  1423.  
  1424.            Another very important application in TCP/IP networks is NFS, which
  1425.       stands for Network File System. It is another form of making the network
  1426.       transparent, because it basically allows you to mount directory  hierar-
  1427.       chies from other hosts, so that they appear like local file systems. For
  1428.       example, all users' home directories can be on a central server machine,
  1429.       from which all other hosts on the LAN mount the directory. The effect of
  1430.       this is that users can log into any machine, and find themselves in  the
  1431.       same  home directory.  Similarly, it is possible to install applications
  1432.       that require large amounts of disk space  (such  as  TeX)  on  only  one
  1433.       machine,  and  export these directories to other machines.  We will come
  1434.       back to NFS in chapter 12..
  1435.  
  1436.  
  1437.            Of course, these are only examples of what you can do  over  TCP/IP
  1438.       networks. The possibilities are almost limitless.
  1439.  
  1440.  
  1441.            We  will  now  have a closer look at the way TCP/IP works. You will
  1442.       need this to understand how and why you have to configure your  machine.
  1443.       We will start by examining the hardware, and slowly work our way up.
  1444.  
  1445.  
  1446.       2.3.2  Ethernets
  1447.  
  1448.  
  1449.  
  1450.  
  1451.            The  type  of  hardware most widely used throughout LANs is what is
  1452.       commonly known as Ethernet.  It consists of a single  cable  with  hosts
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.                                  - 23 -
  1462.  
  1463.  
  1464.  
  1465.       being  attached  to it through connectors, taps or transceivers.  Simple
  1466.       Ethernets are quite inexpensive to install, which, together with  a  net
  1467.       transfer  rate  of 10 Megabits per second accounts for much of its popu-
  1468.       larity.
  1469.  
  1470.  
  1471.             Ethernets come in three flavors, called thick  and  thin,  respec-
  1472.       tively,  and  twisted  pair.  Thin and thick Ethernet each use a coaxial
  1473.       cable, differing in width and the way you may  attach  a  host  to  this
  1474.       cable. Thin Ethernet uses a T-shaped ``BNC'' connector, which you insert
  1475.       into the cable, and twist onto a plug on  the  back  of  your  computer.
  1476.       Thick  Ethernet requires that you drill a small hole into the cable, and
  1477.       attach a transceiver using a ``vampire tap''. One or more hosts can then
  1478.       be  connected to the transceiver.  Thin and thick Ethernet cable may run
  1479.       for a maximum of 200 and 500 meters,  respectively,  and  are  therefore
  1480.       also  called  10base-2  and 10base-5.  Twisted pair uses a cable made of
  1481.       two copper wires which is also found  in  ordinary  telephone  installa-
  1482.       tions,  but  usually  requires  additional hardware. It is also known as
  1483.       10base-T.
  1484.  
  1485.  
  1486.            Although adding a host to a thick Ethernet is a  little  hairy,  it
  1487.       does  not  bring  down the network. To add a host to a thinnet installa-
  1488.       tion, you have to disrupt network service for at  least  a  few  minutes
  1489.       because you have to cut the cable to insert the connector.
  1490.  
  1491.  
  1492.            Most  people  prefer  thin  Ethernet,  because it is very cheap: PC
  1493.       cards come for as little as US$ 50, and cable is in the range of  a  few
  1494.       cent  per  meter. However, for large-scale installations, thick Ethernet
  1495.       is more appropriate. For example,  the  Ethernet  at  GMU's  Mathematics
  1496.       Department  uses  thick  Ethernet, so traffic will not be disrupted each
  1497.       time a host is added to the network.
  1498.  
  1499.  
  1500.            One of the drawbacks of Ethernet technology is  its  limited  cable
  1501.       length, which precludes any use of it other than for LANs. However, sev-
  1502.       eral Ethernet segments may be linked  to  each  other  using  repeaters,
  1503.       bridges  or  routers.  Repeaters  simply copy the signals between two or
  1504.       more segments, so that all segments together will act as if it  was  one
  1505.       Ethernet.   timing  requirements,  there  may  not  be  more  than  four
  1506.       repeaters any two hosts on the network.  Bridges and  Routers  are  more
  1507.       sophisticated.   They analyze incoming data and forward it only when the
  1508.       recipient host is not on the local Ethernet.
  1509.  
  1510.  
  1511.             Ethernet works like a bus system, where a host  may  send  packets
  1512.       (or frames) of up to 1500 bytes to another host on the same Ethernet.  A
  1513.       host is addressed by a six-byte address hardcoded into the  firmware  of
  1514.       its Ethernet board. These addresses are usually written as a sequence of
  1515.       two-digit hex numbers separated by colons, as in aa:bb:cc:dd:ee:ff.
  1516.  
  1517.  
  1518.             A frame sent by one station is seen by all attached stations,  but
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.                                  - 24 -
  1528.  
  1529.  
  1530.  
  1531.       only the destination host actually picks it up and processes it.  If two
  1532.       stations try to send at the same time,  a  collision  occurs,  which  is
  1533.       resolved  by  the  two stations aborting the send, and reattempting it a
  1534.       few moments later.
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.       2.3.3  Other Types of Hardware
  1541.  
  1542.  
  1543.  
  1544.  
  1545.            In larger installations, such as Groucho Marx University,  Ethernet
  1546.       is usually not the only type of equipment used.  At Groucho Marx Univer-
  1547.       sity, each department's LAN is linked to the campus backbone, which is a
  1548.       fiber optics cable running FDDI (Fiber Distributed Data Interface). FDDI
  1549.       uses an entirely different approach to transmitting  data,  which  basi-
  1550.       cally  involves  sending  around a number of tokens, with a station only
  1551.       being allowed to send a frame if it captures a token. The main advantage
  1552.       of  FDDI  is a speed of up to 100 Mbps, and a maximum cable length of up
  1553.       to 200 km.
  1554.  
  1555.  
  1556.             For long-distance network links, a different type of equipment  is
  1557.       frequently used, which is based on a standard named X.25. Many so-called
  1558.       Public Data Networks, like Tymnet in the U.S., or  Datex-P  in  Germany,
  1559.       offer  this  service.  X.25  requires  special hardware, namely a Packet
  1560.       Assembler/Disassembler or PAD.  X.25 defines a set of networking  proto-
  1561.       cols  of  its  own right, but is nevertheless frequently used to connect
  1562.       networks running TCP/IP and other protocols.  Since  IP  packets  cannot
  1563.       simply  be  mapped  onto X.25 (and vice versa), they are simply encapsu-
  1564.       lated in X.25 packets and sent over the network.
  1565.  
  1566.  
  1567.             Frequently, radio amateurs use their equipment  to  network  their
  1568.       computers;  this  is called packet radio or ham radio. The protocol used
  1569.       by ham radios is called AX.25, which was derived from X.25.
  1570.  
  1571.  
  1572.            Other techniques involve using slow  but  cheap  serial  lines  for
  1573.       dial-up  access.  These require yet another protocol for transmission of
  1574.       packets, such as SLIP or PPP, which will be described below.
  1575.  
  1576.  
  1577.       2.3.4  The Internet Protocol
  1578.  
  1579.  
  1580.  
  1581.  
  1582.            Of course, you wouldn't want your networking to be limited  to  one
  1583.       Ethernet. Ideally, you would want to be able to use a network regardless
  1584.       of what hardware it runs on and how many subunits it is made up of.  For
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.                                  - 25 -
  1594.  
  1595.  
  1596.  
  1597.       example,  in  larger  installations such as Groucho Marx University, you
  1598.       usually have a number of separate Ethernets that have to be connected in
  1599.       some  way.  At GMU, the maths department runs two Ethernets: one network
  1600.       of fast machines for professors and graduates, and another one with slow
  1601.       machines for students. Both are linked to the FDDI campus backbone.
  1602.  
  1603.  
  1604.              This connection is handled by a dedicated host, a so-called gate-
  1605.       way, which handles incoming and outgoing packets by copying them between
  1606.       the  two  Ethernets and the fiber optics cable.  For example, if you are
  1607.       at the Maths Department, and want to access quark on the Physics  Depar-
  1608.       ment's  LAN  from  your  Linux  box, the networking software cannot send
  1609.       packets to quark directly, because it  is  not  on  the  same  Ethernet.
  1610.       Therefore,  it  has  to  rely  on the gateway to act as a forwarder. The
  1611.       gateway (name it sophus) then forwards these packets to its peer gateway
  1612.       niels at the Physics Department, using the backbone, with niels deliver-
  1613.       ing it to the destination machine. Data flow between erdos and quark  is
  1614.       shown in figure 2.3.4 (With apologies to Guy L. Steele).
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.              This scheme of directing data to a remote host is called routing,
  1621.       and packets are often referred to as  datagrams  in  this  context.   To
  1622.       facilitate  things,  datagram  exchange is governed by a single protocol
  1623.       that is independent of the hardware used: IP, or Internet Protocol.   In
  1624.       chapter  3.,  we  will  cover  IP  and  the issues of routing in greater
  1625.       detail.
  1626.  
  1627.  
  1628.             The main benefit of IP is that it turns physically dissimilar net-
  1629.       works  into one apparently homogeneous network. This is called internet-
  1630.       working, and the resulting ``meta-network'' is called an internet.  Note
  1631.       the  subtle  difference  between  an internet and the Internet here. The
  1632.       latter is the official name of one particular global internet.
  1633.  
  1634.  
  1635.             Of course, IP  also  requires  a  hardware-independent  addressing
  1636.       scheme.  This is achieved by assigning each host a unique 32-bit number,
  1637.       called the IP address. An IP address is usually written as four  decimal
  1638.       numbers,  one  for  each  8-bit portion, separated by dots. For example,
  1639.       quark might have an IP address of 0x954C0C04, which would be written  as
  1640.       149.76.12.4.  This format is also called dotted quad notation.
  1641.  
  1642.  
  1643.              You  will  notice  that  we  now  have  three  different types of
  1644.       addresses: first there is the host's name, like quark, then there are IP
  1645.       addresses,  and  finally,  there are hardware addresses, like the 6-byte
  1646.       Ethernet address. All these somehow have to match, so that when you type
  1647.       rlogin  quark,  the networking software can be given quark's IP address;
  1648.       and when IP delivers any data to the Physics Department's  Ethernet,  it
  1649.       somehow  has  to  find  out  what Ethernet address corresponds to the IP
  1650.       address.  Which is rather confusing.
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.                                  - 26 -
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.       Figure 1.   The three steps of sending a datagram  from  erdos
  1668.                  to quark.
  1669.  
  1670.            We will not go into this here, and  deal  with  it  in  chapter  3.
  1671.       instead.  For  now,  it's enough to remember that these steps of finding
  1672.       addresses are called hostname resolution, for mapping host names onto IP
  1673.       addresses,  and  address  resolution, for mapping the latter to hardware
  1674.       addresses.
  1675.  
  1676.  
  1677.       2.3.5  IP over Serial Lines
  1678.  
  1679.  
  1680.  
  1681.  
  1682.            On serial lines, a ``de facto'' standard known as  SLIP  or  Serial
  1683.       Line  IP  is frequently used.  A modification of SLIP is known as CSLIP,
  1684.       or compressed SLIP, and performs compression of IP headers to make  bet-
  1685.       ter use of the relatively low bandwidth provided by serial  links.(4)  A
  1686.       different  serial  protocol is PPP, or Point-to-Point Protocol.  PPP has
  1687.       many more features than SLIP, including a link  negotiation  phase.  Its
  1688.       main  advantage  over  SLIP is, however, that it isn't limited to trans-
  1689.       porting IP datagrams, but that it was designed to allow for any type  of
  1690.       datagrams to be transmitted.
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.       2.3.6  The Transmission Control Protocol
  1697.  
  1698.  
  1699.  
  1700.  
  1701.            Now,  of  course, sending datagrams from one host to another is not
  1702.       the whole story. If you log into quark, you want to have a reliable con-
  1703.       nection  between  your  rlogin process on erdos and the shell process on
  1704.       quark. Thus, the information sent to and fro must be split up into pack-
  1705.       ets  by  the  sender,  and  reassembled  into  a character stream by the
  1706.       receiver. Trivial as it seems, this involves a number of hairy tasks.
  1707.  
  1708.  
  1709.            A very important thing to know about IP is that, by intent,  it  is
  1710.       not  reliable. Assume that ten people on your Ethernet started download-
  1711.       ing the latest release of XFree86 from GMU's FTP server. The  amount  of
  1712.       traffic  generated  by this might be too much for the gateway to handle,
  1713.       because it's too slow, and it's tight on memory. Now if  you  happen  to
  1714.  
  1715.       
  1716.  
  1717.       4. SLIP  is  described  in  RFC 1055. The header compression
  1718.          CSLIP is based in is described in RFC 1144.
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.                                  - 27 -
  1727.  
  1728.  
  1729.  
  1730.       send  a  packet to quark, sophus might just be out of buffer space for a
  1731.       moment and therefore unable to forward it.  IP solves  this  problem  by
  1732.       simply  discarding  it. The packet is irrevocably lost.  It is therefore
  1733.       the responsibility of the communicating hosts to check the integrity and
  1734.       completeness of the data, and retransmit it in case of an error.
  1735.  
  1736.  
  1737.            This  is  performed  by  yet another protocol, TCP, or Transmission
  1738.       Control Protocol, which builds a reliable service on  top  of  IP.   The
  1739.       essential property of TCP is that it uses IP to give you the illusion of
  1740.       a simple connection between the two  processes  on  your  host  and  the
  1741.       remote machine, so that you don't have to care about how and along which
  1742.       route your data actually travels.  A TCP  connection  works  essentially
  1743.       like  a  two-way  pipe  that  both processes may write to and read from.
  1744.       Think of it as a telephone conversation.
  1745.  
  1746.  
  1747.             TCP identifies the end points of  such  a  connection  by  the  IP
  1748.       addresses  of the two hosts involved, and the number of a so-called port
  1749.       on each host. Ports may be viewed as attachment points for network  con-
  1750.       nections.  If  we are to strain the telephone example a little more, one
  1751.       might compare IP addresses to area codes (numbers map  to  cities),  and
  1752.       port  numbers  to  local codes (numbers map to individual people's tele-
  1753.       phones).
  1754.  
  1755.  
  1756.             In the rlogin example, the client  application  (rlogin)  opens  a
  1757.       port  on  erdos,  and  connects  to port 513 on quark, which the rlogind
  1758.       server is known to listen to.  This establishes a TCP connection.  Using
  1759.       this  connection, rlogind performs the authorization procedure, and then
  1760.       spawns the shell. The shell's standard input and output  are  redirected
  1761.       to  the  TCP  connection,  so  that  anything you type to rlogin on your
  1762.       machine will be passed through the TCP stream and be given to the  shell
  1763.       as standard input.
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.       2.3.7  The User Datagram Protocol
  1770.  
  1771.  
  1772.  
  1773.  
  1774.            Of  course,  TCP isn't the only user protocol in TCP/IP networking.
  1775.       Although suitable for applications like rlogin, the overhead involved is
  1776.       prohibitve for applications like NFS.  Instead, it uses a sibling proto-
  1777.       col of TCP called UDP, or User Datagram Protocol.  Just  like  TCP,  UDP
  1778.       also allows an application to contact a service on a certain port on the
  1779.       remote machine, but it doesn't establish a connection for this. Instead,
  1780.       you  may  use  it  to  send single packets to the destination service --
  1781.       hence its name.
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.                                  - 28 -
  1793.  
  1794.  
  1795.  
  1796.            Assume you have  mounted  the  TeX  directory  hierarchy  from  the
  1797.       department's central NFS server, galois, and you want to view a document
  1798.       describing how to use LaTeX. You start your editor, who first  reads  in
  1799.       the entire file. However, it would take too long to establish a TCP con-
  1800.       nection with galois, send the file, and release  it  again.  Instead,  a
  1801.       request  is  made to galois, who sends the file in a couple of UDP pack-
  1802.       ets, which is much faster.  However, UDP  was  not  made  to  deal  with
  1803.       packet  loss  or corruption.  It is up to the application -- NFS in this
  1804.       case -- to take care of this.
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.       2.3.8  More on Ports
  1811.  
  1812.  
  1813.  
  1814.  
  1815.            Ports may be viewed as attachment points for  network  connections.
  1816.       If  an  application wants to offer a certain service, it attaches itself
  1817.       to a port and waits for clients (this is also called  listening  on  the
  1818.       port).   A client that wants to use this service allocates a port on its
  1819.       local host, and connects to the server's port on the remote host.
  1820.  
  1821.  
  1822.             An important property of ports is that once a connection has  been
  1823.       established  between  the  client  and  the  server, another copy of the
  1824.       server may attach to the server port and listen for more clients.   This
  1825.       permits,  for  instance,  several  concurrent  remote logins to the same
  1826.       host, all using the same port 513. TCP is able to tell these connections
  1827.       from  each  other,  because they all come from different ports or hosts.
  1828.       For example, if you twice log into quark  from  erdos,  then  the  first
  1829.       rlogin  client will use the local port 1023, and the second one will use
  1830.       port 1022.  Both however, will connect to the same port 513 on quark.
  1831.  
  1832.  
  1833.             This example shows the use of ports as rendezvous points, where  a
  1834.       client  contacts a specific port to obtain a specific service.  In order
  1835.       for a client to know the proper port number,  an  agreement  has  to  be
  1836.       reached  between the administrators of both systems on the assignment of
  1837.       these numbers. For services that are widely used, such as rlogin,  these
  1838.       numbers  have to be administered centrally. This is done by the IETF (or
  1839.       Internet Engineering Task Force), which regularly releases an RFC titled
  1840.       Assigned  Numbers.  It  describes,  among other things, the port numbers
  1841.       assigned to well-known services. Linux uses a file mapping service names
  1842.       to numbers, called /etc/services. It is described in section 10.3.
  1843.  
  1844.  
  1845.            It  is worth noting that although both TCP and UDP connections rely
  1846.       on ports, these numbers do not conflict. This means that TCP  port  513,
  1847.       for  example, is different from UDP port 513. In fact, these ports serve
  1848.       as access points for two different services,  namely  rlogin  (TCP)  and
  1849.       rwho (UDP).
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.                                  - 29 -
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.       2.3.9  The Socket Library
  1866.  
  1867.  
  1868.  
  1869.  
  1870.            In  Un*x  operating  systems, the software performing all the tasks
  1871.       and protocols described above is usually part of the kernel, and  so  it
  1872.       is  in Linux. The programming interface most common in the Un*x world is
  1873.       the Berkeley Socket Library. Its name derives  from  a  popular  analogy
  1874.       that views ports as sockets, and connecting to a port as plugging in. It
  1875.       provides the (bind(2)) call to specifiy a remote host, a transport  pro-
  1876.       tocol,  and  a  service  which a program can connect or listen to (using
  1877.       connect(2), listen(2), and accept(2)).  The socket  library  is  however
  1878.       somewhat  more  general, in that it provides not only a class of TCP/IP-
  1879.       based sockets (the AF INET sockets), but also a class that handles  con-
  1880.       nections  local to the machine (the AF UNIX class). Some implementations
  1881.       can also handle other classes as well, like the  XNS  (Xerox  Networking
  1882.       System) protocol, or X.25.
  1883.  
  1884.  
  1885.            In  Linux,  the  socket  library  is  part  of  the standard libc C
  1886.       library. Currently, it only supports AF INET and  AF UNIX  sockets,  but
  1887.       efforts  are  made to incorporate support for Novell's networking proto-
  1888.       cols, so that eventually one or more socket classes for these  would  be
  1889.       added.
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.       2.4  Linux Networking
  1896.  
  1897.  
  1898.  
  1899.  
  1900.            Being  the  result  of a concerted effort of programmers around the
  1901.       world, Linux wouldn't have been possible without the global network.  So
  1902.       it's not surprising that already in early stages of development, several
  1903.       people started to work on providing it with network capabilities. A UUCP
  1904.       implementation  was running on Linux almost from the very beginning, and
  1905.       work on TCP/IP-based networking started around autumn  1992,  when  Ross
  1906.       Biro and others created what now has become known as Net-1.
  1907.  
  1908.  
  1909.            After  Ross  quit  active  development in May 1993, Fred van Kempen
  1910.       began to work on a new implementation,  rewriting  major  parts  of  the
  1911.       code.  This  ongoing  effort  is known as Net-2. A first public release,
  1912.       Net-2d, was made in Summer 1992 (as part of the 0.99.10 kernel), and has
  1913.       since  been maintained and expanded by several people, most notably Alan
  1914.       Cox, as Net-2Debugged.  After heavy debugging and numerous  improvements
  1915.       to  the code, he changed its name to Net-3 after Linux 1.0 was released.
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.  
  1924.                                  - 30 -
  1925.  
  1926.  
  1927.  
  1928.       This is the version of the networking code  currently  included  in  the
  1929.       official kernel releases.
  1930.  
  1931.  
  1932.            Net-3  offers device drivers for a wide variety of Ethernet boards,
  1933.       as well as SLIP (for sending network traffic  over  serial  lines),  and
  1934.       PLIP  (for  parallel lines).  With Net-3, Linux has a TCP/IP implementa-
  1935.       tion that behaves very well in a local area network environment, showing
  1936.       uptimes  that  beat  some  of the commercial PC Un*ces. Development cur-
  1937.       rently moves toward the necessary stability to reliably run it on Inter-
  1938.       net hosts.
  1939.  
  1940.  
  1941.            Beside  these  facilities, there are several projects going on that
  1942.       will enhance the versatility of Linux.  A driver for PPP (the  point-to-
  1943.       point  protocol, another way to send network traffic over serial lines),
  1944.       is at Beta stage currently, and an AX.25 driver  for  ham  radio  is  at
  1945.       Alpha  stage.  Alan  Cox  has also implemented a driver for Novell's IPX
  1946.       protocol, but the effort for a complete networking suite compatible with
  1947.       Novell's  has  been  put  on  hold  for  the moment, because of Novell's
  1948.       unwillingness to provide  the  necessary  documentation.   Another  very
  1949.       promising  undertaking is samba, a free NetBIOS server for Un*ces, writ-
  1950.       ten by Andrew Tridgell.(5)
  1951.  
  1952.  
  1953.       2.4.1  Different Streaks of Development
  1954.  
  1955.  
  1956.  
  1957.  
  1958.            In  the  meanwhile, Fred continued development, going on to Net-2e,
  1959.       which features a much revised design of the networking  layer.   At  the
  1960.       time  of  writing,  Net-2e  is  still Beta software.  Most notable about
  1961.       Net-2e is the incorporation of DDI, the Device  Driver  Interface.   DDI
  1962.       offers  a  uniform  access  and  configuration  method to all networking
  1963.       devices and protocols.
  1964.  
  1965.  
  1966.             Yet another implemtation of TCP/IP networking comes from  Matthias
  1967.       Urlichs,  who  wrote  an ISDN driver for Linux and FreeBSD. For this, he
  1968.       integrated some of the BSD networking code in the Linux kernel.
  1969.  
  1970.  
  1971.            For the foreseeable future, however, Net-3  seems  to  be  here  to
  1972.       stay.   Alan  currently works on an implementation of the AX.25 protocol
  1973.       used by ham radio amateurs. Doubtlessly, the yet to be developed  ``mod-
  1974.       ule'' code for the kernel will also bring new impulses to the networking
  1975.       code. Modules allow you to add drivers to the kernel at run time.
  1976.  
  1977.  
  1978.            Although these different  network  implementations  all  strive  to
  1979.  
  1980.       
  1981.  
  1982.       5. NetBIOS  is  the  protocol  on  which  applications  like
  1983.          lanmanager and Windows for Workgroups are based.
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.                                  - 31 -
  1992.  
  1993.  
  1994.  
  1995.       provide  the  same  service, there are major differences between them at
  1996.       the kernel and device level.  Therefore, you will not be able to config-
  1997.       ure  a  system  running  a  Net-2e  kernel with utilities from Net-2d or
  1998.       Net-3, and vice versa. This only applies to commands that deal with ker-
  1999.       nel  internals  rather  closely; applications and common networking com-
  2000.       mands such as rlogin or telnet run on either of them.
  2001.  
  2002.  
  2003.            Nevertheless, all these different network version should not  worry
  2004.       you.   Unless  you are participating in active development, you will not
  2005.       have to worry about which version of the TCP/IP code you run. The  offi-
  2006.       cial  kernel  releases will always be accompanied by a set of networking
  2007.       tools that are compatible with the networking code present in  the  ker-
  2008.       nel.
  2009.  
  2010.  
  2011.       2.4.2  Where to Get the Code
  2012.  
  2013.  
  2014.  
  2015.  
  2016.            The  latest  version  of  the Linux network code can be obtained by
  2017.       anonymous FTP from various sites. The official FTP  site  for  Net-3  is
  2018.       sunacm.swan.ac.uk,    mirrored    by    sunsite.unc.edu    below    sys-
  2019.       tem/Network/sunacm.  The latest Net-2e patch kit and binaries are avail-
  2020.       able  from  ftp.aris.com.  Matthias Urlichs' BSD-derived networking code
  2021.       can be gotten from ftp.ira.uka.de in /pub/system/linux/netbsd.
  2022.  
  2023.  
  2024.            The   latest   kernels   can   be   found   on   nic.funet.fi    in
  2025.       /pub/OS/Linux/PEOPLE/Linus;   sunsite  and  tsx-11.mit.edu  mirror  this
  2026.       directory.
  2027.  
  2028.  
  2029.       2.5  Maintaining Your System
  2030.  
  2031.  
  2032.  
  2033.  
  2034.            Throughout this book, we will mainly  deal  with  installation  and
  2035.       configuration  issues.  Administration  is, however, much more than that
  2036.       --- after setting up a service, you have to keep it running,  too.   For
  2037.       most of them, only little attendance will be necessary, while some, like
  2038.       mail and news, require that you perform routine tasks to keep your  sys-
  2039.       tem up-to-date.  We will discuss these tasks in later chapters.
  2040.  
  2041.  
  2042.            The  absolute  minimum  in  maintenance is to check system and per-
  2043.       application log files regularly for error conditions and unusual events.
  2044.       Commonly, you will want to do this by writing a couple of administrative
  2045.       shell scripts and run them from cron periodically.  The source distribu-
  2046.       tion  of  some  major  applications,  like smail or C News, contain such
  2047.       scripts.  You only have to tailor them to suit your  needs  and  prefer-
  2048.       ences.
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.                                  - 32 -
  2058.  
  2059.  
  2060.  
  2061.            The output from any of your cron jobs should be mailed to an admin-
  2062.       istrative  account.  By  default,  many  applications  will  send  error
  2063.       reports,  usage  statistics,  or  logfile summaries to the root account.
  2064.       This only makes sense if you log in as root frequently;  a  much  better
  2065.       idea  is  to  forward  root's mail to your personal account setting up a
  2066.       mail alias as described in chapter 15..
  2067.  
  2068.  
  2069.            However carefully you have configured your site, Murphy's law guar-
  2070.       antees that some problem will surface eventually. Therefore, maintaining
  2071.       a system also means being  available  for  complaints.  Usually,  people
  2072.       expect  that  the system administrator can at least be reached via email
  2073.       as root, but there are also other addresses that are  commonly  used  to
  2074.       reach  the  person responsible for a specific aspect of maintenence. For
  2075.       instance, complaints about a malfunctioning mail configuration will usu-
  2076.       ally  be  addressed postmaster; and problems with the news system may be
  2077.       reported to newsmaster or usenet. Mail to  hostmaster  should  be  redi-
  2078.       rected to the person in charge of the host's basic network services, and
  2079.       the DNS name service if you run a name server.
  2080.  
  2081.  
  2082.       2.5.1  System Security
  2083.  
  2084.  
  2085.  
  2086.  
  2087.            Another very important aspect of system administration in a network
  2088.       environment  is  protecting your system and users from intruders.  Care-
  2089.       lessly managed systems offer malicious  people  many  targets:   attacks
  2090.       range from password guessing to Ethernet snooping, and the damage caused
  2091.       may range from faked mail messages to data loss  or  violation  of  your
  2092.       users' privacy. We will mention some particular problems when discussing
  2093.       the context they may occur in, and some common defenses against them.
  2094.  
  2095.  
  2096.            This section will discuss a few examples and  basic  techniques  in
  2097.       dealing  with  system  security.   Of course, the topics covered can not
  2098.       treat all security issues you  may  be  faced  with  exhaustively;  they
  2099.       merely  serve  to  illustrate  the  problems that may arise.  Therefore,
  2100.       reading a good book on security is an absolute  must,  especially  in  a
  2101.       networked  system.  Simon Garfinkel's ``Practical UNIX Security'' (see [
  2102.       GETST "security" ]) is highly recommendable.
  2103.  
  2104.  
  2105.            System  security  starts  with  good  system  administration.  This
  2106.       includes  checking  the ownership and permissions of all vital files and
  2107.       directories, monitoring use of privileged accounts, etc. The  COPS  pro-
  2108.       gram, for instance, will check your file system and common configuration
  2109.       files for unusual permissions or other anomalies. It is also wise to use
  2110.       a  password  suite  that  enforces certain rules on the users' passwords
  2111.       that make them hard to guess. The shadow password suite,  for  instance,
  2112.       requires  a  password  to  have  at least five letters, and contain both
  2113.       upper and lower case numbers and digits.
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.                                  - 33 -
  2124.  
  2125.  
  2126.  
  2127.             When making a service accessible to the network, make sure to give
  2128.       it  ``least  privilege,''  meaning that you don't permit it to do things
  2129.       that aren't required for it to work as designed. For example, you should
  2130.       make  programs setuid to root or some other privileged account only when
  2131.       they really need this. Also, if you want to use a  service  for  only  a
  2132.       very  limited  application,  don't  hesitate to configure it as restric-
  2133.       tively as your special application allows. For instance, if you want  to
  2134.       allow  diskless  hosts  to  boot from your machine, you must provide the
  2135.       TFTP (trivial file transfer service) so that  they  can  download  basic
  2136.       configuration  files  from the /boot directory. However, when used unre-
  2137.       stricted, TFTP allows any user anywhere in the  world  to  download  any
  2138.       world-readable  file from your system. If this is not what you want, why
  2139.       not restrict TFTP service to the /boot directory?(6)
  2140.  
  2141.  
  2142.             Along the same line of thought, you might want to restrict certain
  2143.       services  to  users from certain hosts, say from your local network.  In
  2144.       chapter 10., we introduce tcpd which does this for a variety of  network
  2145.       applications.
  2146.  
  2147.  
  2148.            Another  important  point  is  to  avoid ``dangerous'' software. Of
  2149.       course, any software you use can be dangerous, because software may have
  2150.       bugs  that  clever  people  might exploit to gain access to your system.
  2151.       Things like these happen, and there's  no  complete  protection  against
  2152.       this.   This  problem  affects  free  software  and  commercial products
  2153.       alike.(7)  However,  programs  that require special privilege are inher-
  2154.       ently more dangerous than others, because any loophole can have  drastic
  2155.       consequences.(8) If you install a setuid program for network purposes be
  2156.       doubly  careful  that you don't miss anything from the documentation, so
  2157.       that you don't create a security breach by accident.
  2158.  
  2159.  
  2160.             You can never rule out that your precautions might  fail,  regard-
  2161.       less  how  careful  you  have  been.  You should therefore make sure you
  2162.       detect intruders early. Checking the system log files is a good starting
  2163.       point, but the intruder is probably as clever, and will delete any obvi-
  2164.       ous traces he or she left. However, there  are  tools  like  tripwire(9)
  2165.       that  allow  you to check vital system files to see if their contents or
  2166.       permissions have been changed.  tripwire computes various strong  check-
  2167.       sums  over these files and stores them in a database.  During subsequent
  2168.       runs, the checksums are re-computed and compared to the stored  ones  to
  2169.       detect any modifications.
  2170.  
  2171.  
  2172.       
  2173.  
  2174.       6. We will come back to this in chapter 10..
  2175.       7. There have been commercial Un*ces you have to pay lots of
  2176.          money for that came with a setuid-root shell script which
  2177.          allowed users to  gain  root  privilege  using  a  simple
  2178.          standard trick.
  2179.       8. In  1988,  the RTM worm brought much of the Internet to a
  2180.          grinding halt, partly by exploiting a gaping hole in some
  2181.          sendmail  programs.  This hole has long been fixed since.
  2182.       9. Written by Gene Kim and Gene Spafford.
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.                                  - 34 -
  2191.  
  2192.  
  2193.  
  2194.       2.6  Outlook on the Following Chapters
  2195.  
  2196.       The  next  few chapters will deal with configuring Linux for TCP/IP net-
  2197.       working, and with running some major applications.  Before  getting  our
  2198.       hands  dirty with file editing and the like, we will examine IP a little
  2199.       closer in chapter 3.. If you already  know  about  the  way  IP  routing
  2200.       works,  and  how address resolution is performed, you might want to skip
  2201.       this chapter.
  2202.  
  2203.  
  2204.            Chapter 4. deals with the very basic configuration issues, such  as
  2205.       building a kernel and setting up your Ethernet board.  The configuration
  2206.       of your serial ports is covered in a separate chapter, because the  dis-
  2207.       cussion  does  not apply to TCP/IP networking only, but is also relevant
  2208.       for UUCP.
  2209.  
  2210.  
  2211.            Chapter 6. helps you to set up your machine for TCP/IP  networking.
  2212.       It  contains  installation hints for standalone hosts with only loopback
  2213.       enabled, and hosts connected to an Ethernet.  It will also introduce you
  2214.       to a few useful tools you can use to test and debug your setup. The next
  2215.       chapter discusses how to configure hostname resolution, and explains how
  2216.       to set up a name server.
  2217.  
  2218.  
  2219.            This  is  followed  by two chapters featuring the configuration and
  2220.       use of SLIP and PPP, respectively. Chapter 8. explains how to  establish
  2221.       SLIP  connections,  and  gives  a detailed reference of dip, a tool that
  2222.       allows you to automate most of the necessary steps.  Chapter  9.  covers
  2223.       PPP and pppd, the PPP daemon you need for this.
  2224.  
  2225.  
  2226.            Chapter  10.  gives  a short introduction to setting up some of the
  2227.       most important network applications, such as rlogin, rcp, etc, in  chap-
  2228.       ter  10..  This also covers how services are managed by the inetd super,
  2229.       and how you may restrict certain security-relevant services to a set  of
  2230.       trusted hosts.
  2231.  
  2232.  
  2233.            The  next two chapters discuss NIS, the Network Information System,
  2234.       and NFS, the Network File System.  NIS is a useful  tool  to  distribute
  2235.       administative  information  such  as user passwords in a local area net-
  2236.       work.  NFS allows you to share file systems  between  several  hosts  in
  2237.       your network.
  2238.  
  2239.  
  2240.            Chapter  13. gives you an extensive introduction to the administra-
  2241.       tion of Taylor UUCP, a free implementation of the UUCP suite.
  2242.  
  2243.  
  2244.            The remainder of the book is taken up by a detailed tour  of  elec-
  2245.       tronic  mail  and Usenet News. Chapter 14. introduces you to the central
  2246.       concepts of electronic mail, like what a mail address  looks  like,  and
  2247.       how  the  mail  handling  system  manages  to  get  your  message to the
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.                                  - 35 -
  2257.  
  2258.  
  2259.  
  2260.       recipient.
  2261.  
  2262.  
  2263.            Chapters 15. and 16. each cover the setup of  smail  and  sendmail,
  2264.       two  mail  transport  agents  you can use for Linux.  This book explains
  2265.       both of them, because smail is easier to install for the beginner, while
  2266.       sendmail is more flexible.
  2267.  
  2268.  
  2269.            Chapters  17.  and  18. explain the way news are managed in Usenet,
  2270.       and how you install and use C news, a popular software package for  man-
  2271.       aging Usenet news. Chapter 19. briefly covers how to set up an NNTP dae-
  2272.       mon to provide news reading access for your local network.  Chapter  20.
  2273.       finally shows you how to configure and maintain various newsreaders.
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.  
  2320.  
  2321.  
  2322.                                  - 36 -
  2323.  
  2324.  
  2325.  
  2326.       3.  Issues of TCP/IP Networking
  2327.  
  2328.  
  2329.  
  2330.  
  2331.            We will now turn to the details you'll come in touch with when con-
  2332.       necting your Linux machine to a TCP/IP network including dealing with IP
  2333.       addresses, host names, and sometimes routing issues.  This chapter gives
  2334.       you the background you need in  order  to  understand  what  your  setup
  2335.       requires,  while  the  next  chapters  will cover the tools to deal with
  2336.       these.
  2337.  
  2338.  
  2339.       3.1  Networking Interfaces
  2340.  
  2341.  
  2342.  
  2343.  
  2344.            To hide the diversity of equipment that may be used in a networking
  2345.       environment,  TCP/IP  defines  an  abstract  interface through which the
  2346.       hardware is accessed. This interface offers a set of operations which is
  2347.       the  same for all types of hardware and basically deals with sending and
  2348.       receiving packets.
  2349.  
  2350.  
  2351.            For each periphereal device you want to use for networking, a  cor-
  2352.       responding  interface has to be present in the kernel. For example, Eth-
  2353.       ernet interfaces in Linux are called eth0 and eth1, and SLIP  interfaces
  2354.       come as sl0, sl1, etc.  These interface names are used for configuration
  2355.       purposes when you want to name a particular physical device to the  ker-
  2356.       nel. They have no meaning beyond that.
  2357.  
  2358.  
  2359.            To  be useable for TCP/IP networking, an interface must be assigned
  2360.       an IP address which serves as its identifcation when communicating  with
  2361.       the rest of the world. This address is different from the interface name
  2362.       mentioned above; if you compare an interface to door, then  the  address
  2363.       is like the name-plate pinned on it.
  2364.  
  2365.  
  2366.            Of  course,  there are other device parameters that may be set; one
  2367.       of these is the maximum size of datagrams that can be processed by  that
  2368.       particular piece of hardware, also called Maximum Transfer Unit, or MTU.
  2369.       Other attributes will be introduced later.
  2370.  
  2371.  
  2372.       3.2  IP Addresses
  2373.  
  2374.  
  2375.  
  2376.  
  2377.            As mentioned in the previous chapter, the addresses  understood  by
  2378.       the  IP  networking  protocol  are 32-bit numbers. Every machine must be
  2379.       assigned a number unique to  the  networking  environment.  If  you  are
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.                                  - 37 -
  2389.  
  2390.  
  2391.  
  2392.       running  a  local  network  that does not have TCP/IP traffic with other
  2393.       networks, you may assign these numbers according to your personal  pref-
  2394.       erences.  However,  for sites on the Internet, numbers are assigned by a
  2395.       central authority, the Network Information Center, or NIC.(1)
  2396.  
  2397.  
  2398.             For easier reading, IP addresses are split up into four 8 bit num-
  2399.       bers called octets.  For example, quark.physics.groucho.edu  has  an  IP
  2400.       address  of 0x954C0C04, which is written as 149.76.12.4.  This format is
  2401.       often referred to as the dotted quad notation.
  2402.  
  2403.  
  2404.            Another reason for this notation is that  IP  addresses  are  split
  2405.       into  a  network number, which is contained in the leading octets, and a
  2406.       host number, which is the remainder.  When applying to the  NIC  for  IP
  2407.       addresses, you are not assigned an address for each single host you plan
  2408.       to use. Instead, you are given a network  number,  and  are  allowed  to
  2409.       assign all valid IP addresses within this range to hosts on your network
  2410.       according to your preferences.
  2411.  
  2412.  
  2413.            Depending on the size of the network, the host part may need to  be
  2414.       smaller  or  larger.  To  accomodate  different needs, there are several
  2415.       classes of networks, defining different splits of IP addresses.
  2416.  
  2417.  
  2418.  
  2419.  
  2420.         Class A Class A comprises networks  1.0.0.0  through  127.0.0.0.   The
  2421.                 network number is contained in the first octet.  This provides
  2422.                 for a 24 bit host part, allowing roughly 1.6 million hosts.
  2423.  
  2424.  
  2425.         Class B Class B contains networks 128.0.0.0 through  191.255.0.0;  the
  2426.                 network  number  is  in the first two octets.  This allows for
  2427.                 16320 nets with 65024 hosts each.
  2428.  
  2429.  
  2430.         Class C Class C networks range from 192.0.0.0  through  223.255.255.0,
  2431.                 with  the  network  number  being contained in the first three
  2432.                 octets. This allows for nearly 2 million networks with  up  to
  2433.                 254 hosts.
  2434.  
  2435.  
  2436.       Classes D, E, and F Addresses   falling  into  the  range  of  224.0.0.0
  2437.                 through 254.0.0.0 are either experimental, or are reserved for
  2438.                 future use and don't specify any network.
  2439.  
  2440.  
  2441.  
  2442.       
  2443.  
  2444.       1. Frequently, IP addresses will be assigned to you  by  the
  2445.          provider  you buy your IP connectivity from. However, you
  2446.          may also apply to NIC directly for an IP address for your
  2447.          network by sending a mail to hostmaster@internic.net.
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.                                  - 38 -
  2456.  
  2457.  
  2458.  
  2459.            If  we go back to the example in the previous chapter, we find that
  2460.       149.76.12.4, the address of quark, refers to host 12.4 on  the  class  B
  2461.       network 149.76.0.0.
  2462.  
  2463.  
  2464.              You may have noticed that in the above list not all possible val-
  2465.       ues were allowed for each octet in the host part. This is  because  host
  2466.       numbers  with octets all 0 or all 255 are reserved for special purposes.
  2467.       An address where all host part bits are zero refers to the network,  and
  2468.       one where all bits of the host part are 1 is called a broadcast address.
  2469.       This refers to all hosts on the specified network simultaneously.  Thus,
  2470.       149.76.255.255  is  not a valid host address, but refers to all hosts on
  2471.       network 149.76.0.0.
  2472.  
  2473.  
  2474.             There are also two network addresses that  are  reserved,  0.0.0.0
  2475.       and  127.0.0.0.  The  first  is called the default route, the latter the
  2476.       loopback address. The default route has something to do with the way  IP
  2477.       routes datagrams, which will be dealt with below.
  2478.  
  2479.  
  2480.            Network  127.0.0.0  is  reserved for IP traffic local to your host.
  2481.       Usually, address 127.0.0.1 will be assigned to a  special  interface  on
  2482.       your  host,  the  so-called loopback interface, which acts like a closed
  2483.       circuit. Any IP packet handed to it from TCP or UDP will be returned  to
  2484.       them  as  if  it had just arrived from some network.  This allows you to
  2485.       develop and test networking software without ever using a ``real''  net-
  2486.       work.  Another  useful  application  is  when you want to use networking
  2487.       software on a standalone host. This may not be as uncommon as it sounds;
  2488.       for  instance,  many  UUCP  sites don't have IP connectivity at all, but
  2489.       still want to run the INN news system nevertheless. For proper operation
  2490.       on Linux, INN requires the loopback interface.
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.       3.3  Address Resolution
  2497.  
  2498.  
  2499.  
  2500.  
  2501.            Now  that you've seen how IP addresses are made up, you may be won-
  2502.       dering how they are used on an  Ethernet  to  address  different  hosts.
  2503.       After  all, the Ethernet protocol identifies hosts by a six-octet number
  2504.       that has absolutely nothing in common with an IP address, doesn't it?
  2505.  
  2506.  
  2507.             Right. That's why a mechanism is needed to map IP  addresses  onto
  2508.       Ethernet  addresses.  This is the so-called Address Resolution Protocol,
  2509.       or ARP. In fact, ARP is not confined to Ethernets at all, but is used on
  2510.       other types networks such as ham radio as well.  The idea underlying ARP
  2511.       is exactly what most people do when they have to find Mr. X. Ample in  a
  2512.       throng  of  150  people:  they go round, calling out his name, confident
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520.  
  2521.                                  - 39 -
  2522.  
  2523.  
  2524.  
  2525.       that he will respond if he's there.
  2526.  
  2527.  
  2528.            When ARP wants to find out the Ethernet address corresponding to  a
  2529.       given  IP  address,  it uses a feature of Ethernet known as ``broadcast-
  2530.       ing,'' where a datagram is addressed to  all  stations  on  the  network
  2531.       simultaneously.  The broadcast datagram sent by ARP contains a query for
  2532.       the IP address. Each receiving host compares this to its own IP address,
  2533.       and  if  it  matches,  returns  an  ARP reply to the inquiring host. The
  2534.       inquiring host can now extract the sender's Ethernet  address  from  the
  2535.       reply.
  2536.  
  2537.  
  2538.            Of course you might wonder how a host may know on which of the zil-
  2539.       lions of Ethernets throughout the world it is to find the desired  host,
  2540.       and  why  this  should  even be an Ethernet. These questions all involve
  2541.       what is called routing, namely finding out the physical  location  of  a
  2542.       host in a network.  This will be the topic of the following section.
  2543.  
  2544.  
  2545.            For a moment, let's talk about ARP a little longer. Once a host has
  2546.       discovered an Ethernet address, it stores it in its ARP cache,  so  that
  2547.       it  doesn't  have to query for it the next time it wants to send a data-
  2548.       gram to the host in question. However, it is unwise to keep this  infor-
  2549.       mation  forever;  for  instance,  the remote host's Ethernet card may be
  2550.       replaced because  of  technical  problems,  so  the  ARP  entry  becomes
  2551.       invalid.  To  force another query for the IP address, entries in the ARP
  2552.       cache are therefore discarded after some time.
  2553.  
  2554.  
  2555.             Sometimes, it is also necessary to find out the IP address associ-
  2556.       ated with a given Ethernet address. This happens when a diskless machine
  2557.       wants to boot from a server on the network, which is quite a common sit-
  2558.       uation on local area networks. A diskless client, however, has virtually
  2559.       no information about itself -- except for its Ethernet address! So  what
  2560.       it  basically  does  is  broadcast  a message containing a plea for boot
  2561.       servers to tell it its IP address. There's another  protocol  for  this,
  2562.       named Reverse Address Resolution Protocol, or RARP. Along with the BOOTP
  2563.       protocol, it serves to define a  procedure  for  bootstrapping  diskless
  2564.       clients over the network.
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.       3.4  IP Routing
  2571.  
  2572.  
  2573.  
  2574.  
  2575.       3.4.1  IP Networks
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.  
  2584.  
  2585.  
  2586.  
  2587.                                  - 40 -
  2588.  
  2589.  
  2590.  
  2591.      W<>n  you  write  a  letter  to someone, you usually put a complete
  2592. address on the envelope, specifying the country, state, zip  code,  etc.
  2593. After you put it into the letter box, the postal service will deliver it
  2594. to its destination: it will be sent  to  the  country  indicated,  whose
  2595. national  service  will dispatch it to the proper state and region, etc.
  2596. The advantage of this hierarchical scheme is  rather  obvious:  Wherever
  2597. you  post  the letter, the local postmaster will know roughly the direc-
  2598. tion to forward the letter to, but doesn't have to care  which  way  the
  2599. letter will travel by within the destination country.
  2600.  
  2601.  
  2602.      IP  networks  are  structured  in a similar way. The whole Internet
  2603. consists of a number of  proper  networks,  called  autonomous  systems.
  2604. Each  such  system  performs any routing between its member hosts inter-
  2605. nally, so that the task of delivering a datagram is reduced to finding a
  2606. path to the destination host's network. This means, as soon as the data-
  2607. gram is handed to any host that is on that particular  network,  further
  2608. processing is done exclusively by the network itself.
  2609.  
  2610.  
  2611. 3.4.2  Subnetworks
  2612.  
  2613.  
  2614.  
  2615.  
  2616.      This  structure  is reflected by splitting IP addresses into a host
  2617. and network part, as explained above. By default, the  destination  net-
  2618. work  is  derived  from  the network part of the IP address. Thus, hosts
  2619. with identical IP network numbers should be found within the  same  net-
  2620. work, and vice versa.(2)
  2621.  
  2622.  
  2623.      It makes sense to offer a similar scheme inside the  network,  too,
  2624. since  it  may  consist  of a collection of hundreds of smaller networks
  2625. itself, with the smallest units being physical networks like  Ethernets.
  2626. Therefore,  IP  allows  you to subdivide an IP network into several sub-
  2627. nets.
  2628.  
  2629.  
  2630.       A subnet takes over responsibility for delivering datagrams  to  a
  2631. certain  range  of  IP  addresses from the IP network it is part of.  As
  2632. with classes A, B, or C, it is identified by the network part of the  IP
  2633. addresses.  However,  the  network  part is now extended to include some
  2634. bits from the host part.  The number of bits that are interpreted as the
  2635. subnet  number  is given by the so-called subnet mask, or netmask.  This
  2636. is a 32 bit number, too, which specifies the bit mask  for  the  network
  2637. part of the IP address.
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644. 2. Autonomous  systems  are  slightly more general, however.
  2645.    They may comprise more than one IP network.
  2646.  
  2647.  
  2648.  
  2649.  
  2650.  
  2651.  
  2652.  
  2653.                            - 41 -
  2654.  
  2655.  
  2656.  
  2657.  
  2658.  
  2659.  
  2660.  
  2661.            Figure 2.   Subnetting a class B network
  2662.  
  2663.  
  2664.        The  campus  network  of Groucho Marx University is an example of
  2665. such a network. It has a class B network number of 149.76.0.0,  and  its
  2666. netmask is therefore 255.255.0.0.
  2667.  
  2668.  
  2669.      Internally,  GMU's  campus network consists of several smaller net-
  2670. works, such as the LANs of various  departments.  So  the  range  of  IP
  2671. addresses   is   broken   up   into   254  subnets,  149.76.1.0  through
  2672. 149.76.254.0.  For example, the Department of  Theoretical  Physics  has
  2673. been  assigned 149.76.12.0.  The campus backbone is a network by its own
  2674. right, and is given 149.76.1.0.  These subnets share the same IP network
  2675. number, while the third octet is used to distinguish between them.  Thus
  2676. they will use a subnet mask of 255.255.255.0.
  2677.  
  2678.  
  2679.      Figure 3.4.2 shows how 149.76.12.4, the address of quark, is inter-
  2680. preted differently when the address is taken as an ordinary class B net-
  2681. work, and when used with subnetting.
  2682.  
  2683.  
  2684.       It is worth noting that subnetting (as the technique of generating
  2685. subnets is called) is only an internal division of the network.  Subnets
  2686. are generated by the network owner (or the administrators).  Frequently,
  2687. subnets  are  created  to  reflect existing boundaries, be they physical
  2688. (between two Ethernets), administrative (between  two  departments),  or
  2689. geographical, and authority over these subnets is delegated to some con-
  2690. tact person. However, this structure affects only the network's internal
  2691. behavior, and is completely invisible to the outside world.
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697. 3.4.3  Gateways
  2698.  
  2699.  
  2700.  
  2701.  
  2702.      Subnetting  is not only an organizational benefit, it is frequently
  2703. a natural consequence of hardware boundaries.  The viewpoint of  a  host
  2704. on a given physical network, such as an Ethernet, is a very limited one:
  2705. the only hosts it is able to talk to directly are those of  the  network
  2706. it  is on.  All other hosts can be accessed only through so-called gate-
  2707. ways.  A gateway is a host that is connected to  two  or  more  physical
  2708. networks  simultaneously  and  is  configured  to switch packets between
  2709. them.
  2710.  
  2711.  
  2712.  
  2713.  
  2714.  
  2715.  
  2716.  
  2717.  
  2718.  
  2719.                            - 42 -
  2720.  
  2721.  
  2722.  
  2723.      For IP to be able to easily recognize if a host is on a local phys-
  2724. ical network, different physical networks have to belong to different IP
  2725. networks. For example the network  number  149.76.4.0  is  reserved  for
  2726. hosts on the mathematics LAN. When sending a datagram to quark, the net-
  2727. work  software  on  erdos  immediately  sees  from   the   IP   address,
  2728. 149.76.12.4,  that  the destination host is on a different physical net-
  2729. work, and therefore can be reached only through  a  gateway  (sophus  by
  2730. default).
  2731.  
  2732.  
  2733.      sophus itself is connected to two distinct subnets: the Mathematics
  2734. Department, and the campus backbone. It accesses each through a  differ-
  2735. ent interface, eth0 and fddi0, respectively.  Now, what IP address do we
  2736. assign it? Should we give it one on subnet 149.76.1.0, or on 149.76.4.0?
  2737.  
  2738.  
  2739.      The  answer  is:  both.  When  talking  to a host on the Maths LAN,
  2740. sophus should use an IP address of 149.76.4.1, and  when  talking  to  a
  2741. host on the backbone, it should use 149.76.1.4.
  2742.  
  2743.  
  2744.      Thus,  a  gateway  is assigned one IP address per network it is on.
  2745. These addresses --- along with the corresponding netmask --- are tied to
  2746. the  interface  the  subnet  is  accessed  through. Thus, the mapping of
  2747. interfaces and addresses for sophus would look like this:
  2748.  
  2749.  
  2750. ----------------------------------------
  2751. +-------+-------------+----------------+
  2752. |iface  |    address  |       netmask  |
  2753. +-------+-------------+----------------+
  2754. +-------+-------------+----------------+
  2755. |eth0   | 149.76.4.1  | 255.255.255.0  |
  2756. |fddi0  | 149.76.1.4  | 255.255.255.0  |
  2757. |lo     |  127.0.0.1  |     255.0.0.0  |
  2758. +-------+-------------+----------------+
  2759. +-------+-------------+----------------+
  2760.  
  2761.      The last entry describes  the  loopback  interface  lo,  which  was
  2762. introduced above.
  2763.  
  2764.  
  2765.      Figure  3.4.3  shows a part of the network topology at Groucho Marx
  2766. University (GMU).  Hosts that are on two subnets at the  same  time  are
  2767. shown with both addresses.
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.      Generally,  you  can ignore the subtle difference between attaching
  2774. an address to a host or its interface. For hosts that are on one network
  2775. only,  like erdos, you would generally refer of the host as having this-
  2776. and-that IP  address  although  strictly  speaking,  it's  the  Ethernet
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.  
  2785.                            - 43 -
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793. Figure 3.   A part of the net topology at Groucho Marx Univ.
  2794.  
  2795.  
  2796. interface  that  has  this IP address. However, this distinction is only
  2797. really important when you refer to a gateway.
  2798.  
  2799.  
  2800.  
  2801.  
  2802.  
  2803. 3.4.4  The Routing Table
  2804.  
  2805.  
  2806.  
  2807.  
  2808.      We are now focusing our attention on how IP chooses  a  gateway  to
  2809. use when delivering a datagram to a remote network.
  2810.  
  2811.  
  2812.      We  have  seen  before that erdos, when given a datagram for quark,
  2813. checks the destination address and finds it is not on the local network.
  2814. It therefore sends it to the default gateway, sophus, which is now basi-
  2815. cally faced with the same task.  sophus recognizes that quark is not  on
  2816. any  of  the networks it is connected to directly, so it has to find yet
  2817. another gateway to forward it  through.  The  correct  choice  would  be
  2818. niels,  the  gateway  to  the Physics Department. sophus therefore needs
  2819. some information to associate a  destination  network  with  a  suitable
  2820. gateway.
  2821.  
  2822.  
  2823.      The routing information IP uses for this is basically a table link-
  2824. ing networks to gateways that reach them. A catch-all entry (the default
  2825. route)  must  generally be supplied, too; this is the gateway associated
  2826. with network 0.0.0.0. All packets to an unknown network are sent through
  2827. the default route.  On sophus, this table might look like this:
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.  
  2847.  
  2848.  
  2849.  
  2850.  
  2851.                            - 44 -
  2852.  
  2853.  
  2854.  
  2855. -----------------------------------------
  2856. +------------+-------------+------------+
  2857. |Network     | Gateway     | Interface  |
  2858. +------------+-------------+------------+
  2859. +------------+-------------+------------+
  2860. |149.76.1.0  | -           | fddi0      |
  2861. |149.76.2.0  | 149.76.1.2  | fddi0      |
  2862. |149.76.3.0  | 149.76.1.3  | fddi0      |
  2863. |149.76.4.0  | -           | eth0       |
  2864. |149.76.5.0  | 149.76.1.5  | fddi0      |
  2865. |...         | ...         | ...        |
  2866. |0.0.0.0     | 149.76.1.2  | fddi0      |
  2867. +------------+-------------+------------+
  2868. +------------+-------------+------------+
  2869.  
  2870.      Routes  to  a  network  that  sophus is directly connected to don't
  2871. require a gateway; therefore they show a gateway entry of ``-''.
  2872.  
  2873.  
  2874.       Routing tables may be built by various means. For small  LANs,  it
  2875. is  usually most efficient to construct them by hand and feed them to IP
  2876. using the route command at boot time (see chapter 6.).  For larger  net-
  2877. works, they are built and adjusted at run-time by routing daemons; these
  2878. run on central hosts of the network and exchange routing information  to
  2879. compute ``optimal'' routes between the member networks.
  2880.  
  2881.  
  2882.        Depending on the size of the network, different routing protocols
  2883. will be used.  For routing inside autonomous systems  (such  as  Groucho
  2884. Marx  campus), the internal routing protocols are used.  The most promi-
  2885. nent one is RIP, the Routing Information Protocol, which is  implemented
  2886. by  the  BSD  routed  daemon.   For  routing between autonomous systems,
  2887. external routing protocols like EGP (External Gateway Protocol), or  BGP
  2888. (Border  Gateway  Protocol) have to be used; these (as well as RIP) have
  2889. been implemented in the University of Cornell's gated daemon.(3)
  2890.  
  2891.  
  2892. 3.4.5  Metric Values
  2893.  
  2894.  
  2895.  
  2896.  
  2897.      Dynamic routing based on RIP chooses the best route to some  desti-
  2898. nation  host  or  network  based on the number of ``hops'', that is, the
  2899. gateways a datagram has to pass before reaching it. The shorter a  route
  2900. is,  the  better RIP rates it. Very long routes with 16 or more hops are
  2901. regarded as unusable, and are discarded.
  2902.  
  2903.  
  2904.      To use RIP to manage routing information  internal  to  your  local
  2905. network,  you have to run gated on all hosts. At boot time, gated checks
  2906.  
  2907.  
  2908. 3. routed is considered broken by many people.  Since  gated
  2909.    supports  RIP  as well, it is better to use that instead.
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.                            - 45 -
  2918.  
  2919.  
  2920.  
  2921. for all active network interfaces.  If there is  more  than  one  active
  2922. interface  (not counting the loopback interface), it assumes the host is
  2923. switching packets between several networks, and will  actively  exchange
  2924. and  broadcast  routing  information.  Otherwise, it will only passively
  2925. receive any RIP updates and update the local routing table.
  2926.  
  2927.  
  2928.      When broadcasting the information from  the  local  routing  table,
  2929. gated  computes  the length of the route from the so-called metric value
  2930. associated with the routing table entry. This metric value is set by the
  2931. system  administrator  when configuring the route and should reflect the
  2932. actual cost of using this route. Therefore, the metric of a route  to  a
  2933. subnet  the host is directly connected to should always be zero, while a
  2934. route going through two gateways should have a metric of  two.  However,
  2935. note  that you don't have to bother about metrics when you don't use RIP
  2936. or gated.
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942. 3.5  The Internet Control Message Protocol
  2943.  
  2944.  
  2945.  
  2946.  
  2947.       IP has a companion protocol that we haven't talked about yet. This
  2948. is  the Internet Control Message Protocol (ICMP) and is used by the ker-
  2949. nel networking code to communicate error messages and the like to  other
  2950. hosts. For instance, assume that you are on erdos again and want to tel-
  2951. net to port 12345 on quark, but there's no  process  listening  on  that
  2952. port. When the first TCP packet for this port arrives on quark, the net-
  2953. working layer will recognize this and immediately return an ICMP message
  2954. to erdos stating ``Port Unreachable''.
  2955.  
  2956.  
  2957.        There  are  quite  a number of messages ICMP understands, many of
  2958. which deal with error conditions. However, there is one very interesting
  2959. message called the Redirect message. It is generated by the routing mod-
  2960. ule when it detects that another host is using it as a gateway, although
  2961. there  is  a  much shorter route. For example, after booting the routing
  2962. table of sophus may be incomplete, containing the routes to  the  Mathe-
  2963. matics  network, to the FDDI backbone, and the default route pointing at
  2964. the Groucho Computing Center's gateway (gcc1).  Therefore,  any  packets
  2965. for quark would be sent to gcc1 rather than to niels, the gateway to the
  2966. Physics Department. When receiving such a  datagram,  gcc1  will  notice
  2967. that  this  is  a  poor  choice of route, and will forward the packet to
  2968. niels, at the same time returning an ICMP  Redirect  message  to  sophus
  2969. telling it of the superior route.
  2970.  
  2971.  
  2972.      Now, this seems a very clever way to avoid having to set up any but
  2973. the most basic routes  manually.  However  be  warned  that  relying  on
  2974. dynamic  routing  schemes,  be  it RIP or ICMP Redirect messages, is not
  2975.  
  2976.  
  2977.  
  2978.  
  2979.  
  2980.  
  2981.  
  2982.  
  2983.                            - 46 -
  2984.  
  2985.  
  2986.  
  2987. always a good idea. ICMP Redirect and RIP offer you little or no  choice
  2988. in  verifying  that  some routing information is indeed authentic.  This
  2989. allows malicious good-for-nothings to disrupt your entire network  traf-
  2990. fic,  or do even worse things.  For this reason, there are some versions
  2991. of the Linux networking code that treat Redirect  messages  that  affect
  2992. network routes, as if they were only Redirects for host routes.
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998. 3.6  The Domain Name System
  2999.  
  3000.  
  3001.  
  3002.  
  3003. 3.6.1  Hostname Resolution
  3004.  
  3005.  
  3006.  
  3007.  
  3008. <>         As described above, addressing in TCP/IP networking revolves around
  3009.       32 bit numbers. However, you will have a hard time remembering more than
  3010.       a  few  of  these.  Therefore, hosts are generally known by ``ordinary''
  3011.       names such as gauss or strange. It is then  the  application's  duty  to
  3012.       find  the IP address corresponding to this name.  This process is called
  3013.       host name resolution.
  3014.  
  3015.  
  3016.            An application that wants to find the IP address of  a  given  host
  3017.       name  does  not  have to provide its own routines for looking up a hosts
  3018.       and IP adresses. Instead, it relies on number of library functions  that
  3019.       do  this  transparently,  called  gethostbyname(3) and gethostbyaddr(3).
  3020.       Traditionally, these and a number of related procedures were grouped  in
  3021.       a separate library called the resolver library; on Linux, these are part
  3022.       of the standard libc.  Colloquially, this collection  of  functions  are
  3023.       therefore referred to as ``the resolver''.
  3024.  
  3025.  
  3026.            Now,  on  a  small  network  like an Ethernet, or even a cluster of
  3027.       them, it is not very difficult to maintain tables mapping host names  to
  3028.       addresses.  This information is usually kept in a file named /etc/hosts.
  3029.       When adding or removing hosts, or reassigning addresses, all you have to
  3030.       do  is update the hosts on all hosts.  Quite obviously, this will become
  3031.       burdensome with networks than comprise more than a handful of  machines.
  3032.  
  3033.  
  3034.            One solution to this problem is NIS, the Network Information System
  3035.       developed by Sun Microsystems, colloquially called YP, or Yellow  Pages.
  3036.       NIS  stores  the  hosts  file (and other information) in a database on a
  3037.       master host, from which clients may retrieve it as needed.  Still,  this
  3038.       approach  is  only  suitable  for  medium-sized  networks  such as LANs,
  3039.       because it involves maintaining the entire hosts database centrally, and
  3040.       distributing it to all servers.
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.                                  - 47 -
  3050.  
  3051.  
  3052.  
  3053.            On the Internet, address information was initially stored in a sin-
  3054.       gle HOSTS.TXT database, too. This file was  maintained  at  the  Network
  3055.       Information  Center,  or  NIC, and had to be downloaded and installed by
  3056.       all participating sites. When the network grew,  several  problems  with
  3057.       this  scheme  arose.  Beside  the  administrative  overhead  involved in
  3058.       installing HOSTS.TXT regularly, the load on the servers that distributed
  3059.       it  became too high. Even more severe was the problem that all names had
  3060.       to be registered with the NIC, which had to make sure that no  name  was
  3061.       issued twice.
  3062.  
  3063.  
  3064.            This  is  why,  in  1984,  a  new  name  resolution scheme has been
  3065.       adopted, the Domain Name System. DNS was designed by  Paul  Mockapetris,
  3066.       and addresses both problems simultaneously.
  3067.  
  3068.  
  3069.       3.6.2  Enter DNS
  3070.  
  3071.  
  3072.  
  3073.  
  3074.            DNS  organizes host names in a hierarchy of domains.  A domain is a
  3075.       collection of sites that are related in some sense  ---  be  it  because
  3076.       they  form a proper network (e.g. all machines on a campus, or all hosts
  3077.       on BITNET), because they all belong to a certain organization (like  the
  3078.       U.S.  government),  or  because they're simply geographically close. For
  3079.       instance, universities are grouped in the edu domain, with each  Univer-
  3080.       sity  or  College using a separate subdomain below which their hosts are
  3081.       subsumed. Groucho Marx University might be given the groucho.edu domain,
  3082.       with   the   LAN   of   the   Mathematics   Department   being  assigned
  3083.       maths.groucho.edu.  Hosts on the departmental network  would  have  this
  3084.       domain  name  tacked  onto  their  host name; so erdos would be known as
  3085.       erdos.maths.groucho.edu.  This is  called  the  fully  qualified  domain
  3086.       name, or FQDN, which uniquely identifies this host world-wide.
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.            Figure  3.6.2  shows a section of the name space.  The entry at the
  3093.       root of this tree, which is denoted by a single dot, is quite  appropri-
  3094.       ately  called  the  root  domain,  and encompasses all other domains. To
  3095.       indicate that a host name is a fully qualified domain name, rather  than
  3096.       a name relative to some (implicit) local domain, it is sometimes written
  3097.       with a trailing dot. This signifies that the name's  last  component  is
  3098.       the root domain.
  3099.  
  3100.  
  3101.              Depending  on its location in the name hierarchy, a domain may be
  3102.       called top-level, second-level, or third-level. More levels of  subdivi-
  3103.       sion  occur,  but  are rare. These are a couple of top-level domains you
  3104.       may see frequently:
  3105.  
  3106.  
  3107.  
  3108.  
  3109.  
  3110.  
  3111.  
  3112.  
  3113.  
  3114.  
  3115.                                  - 48 -
  3116.  
  3117.  
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.                Figure 4.   A part of the domain name space
  3124.  
  3125.  
  3126.             edu (Mostly US) educational institutions like universities, etc.
  3127.  
  3128.  
  3129.             com Commercial organizations, companies.
  3130.  
  3131.  
  3132.             org Non-commercial organizations. Often private UUCP networks  are
  3133.                 in this domain.
  3134.  
  3135.  
  3136.             net Gateways and other administrative host on a network.
  3137.  
  3138.  
  3139.             mil US military institutions.
  3140.  
  3141.  
  3142.             gov US government institutions.
  3143.  
  3144.  
  3145.            uucp Officially, all site names formerly used as UUCP names without
  3146.                 domain, have been moved to this domain.
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.            Technically, the first four of these belong to the US part  of  the
  3153.       Internet,  but  you  may also see non-US sites in these domains. This is
  3154.       especially true of the net domain.  However, mil and gov are used exclu-
  3155.       sively in the US.
  3156.  
  3157.  
  3158.            Outside  the  US, each country generally uses a top-level domain of
  3159.       its own named after the two-letter country  code  defined  in  ISO-3166.
  3160.       Finland,  for  instance, uses the fi domain, fr is used by France, de by
  3161.       Germany, or au by Australia etc.   Below  this  top-level  domain,  each
  3162.       country's  NIC is free to organize host names in whatever way they want.
  3163.       Australia, for example, has second-level domain similar to the  interna-
  3164.       tional top-level domains, named com.au, edu.au, and so on.  Others, like
  3165.       Germany, don't use this extra level, but rather  have  slightly  longish
  3166.       names  that  refer  directly  to  the organizations running a particular
  3167.       domain.  For  example,  it's  not  uncommon  to  see  host  names   like
  3168.       ftp.informatik.uni-erlangen.de. Chalk that up to German efficiency.
  3169.  
  3170.  
  3171.            Of  course,  these  national domains do not imply that a host below
  3172.       that domain is actually located in that country; it  only  signals  that
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.                                  - 49 -
  3182.  
  3183.  
  3184.  
  3185.       the host has been registered with that country's NIC. A Swedish manufac-
  3186.       turer might have a branch in Australia, and still  have  all  its  hosts
  3187.       registered with the se top-level domain.
  3188.  
  3189.  
  3190.            Now,  organizing  the  name  space  in  a hierarchy of domain names
  3191.       nicely solves the problem of name uniqueness; with DNS, a host name  has
  3192.       to be unique only within its domain to give it a name different from all
  3193.       other hosts world-wide. Furthermore, fully  qualified  names  are  quite
  3194.       easy  to  remember.   Taken  by  themselves, these are already very good
  3195.       resaons to split up a large domain into several subdomains.
  3196.  
  3197.  
  3198.             But DNS does even more for you than than this: it  allows  you  to
  3199.       delegate authority over a subdomain to its administrators.  For example,
  3200.       the maintainers at the Groucho Computing Center might create a subdomain
  3201.       for each department; we already encountered the maths and physics subdo-
  3202.       mains above.  When they find the network at the Physics  Department  too
  3203.       large  and  chaotic  to  manage  from outside (after all, physicists are
  3204.       known to be an unruly bunch of people), they  may  simply  pass  control
  3205.       over  the  physics.groucho.edu domain to the administrators of this net-
  3206.       work.  These are then free to use whatever host  names  they  like,  and
  3207.       assign  them  IP  addresses  from  their network in whatever fashion the
  3208.       like, without outside interference.
  3209.  
  3210.  
  3211.             To this end, the name space is split up into zones, each rooted at
  3212.       a  domain.  Note  the subtle difference between a zone and a domain: the
  3213.       domain groucho.edu encompasses all hosts at the Groucho Marx University,
  3214.       while  the  zone groucho.edu includes only the hosts that are managed by
  3215.       the Computing Center directly, for  example  those  at  the  Mathematics
  3216.       Department.   The  hosts at the Physics Department belong to a different
  3217.       zone, namely physics.groucho.edu.  In figure 3.6.2, the start of a  zone
  3218.       is marked by a small circle to the right of the domain name.
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.       3.6.3  Name Lookups with DNS
  3225.  
  3226.  
  3227.  
  3228.  
  3229.            At  first  glance, all this domain and zone fuss seems to make name
  3230.       resolution an awfully complicated business. After  all,  if  no  central
  3231.       authority controls what names are assigned to which hosts, then how is a
  3232.       humble application supposed to know?!
  3233.  
  3234.  
  3235.            Now comes the really ingenuous part about DNS. If you want to  find
  3236.       out the IP address of erdos, then, DNS says, go ask the people that man-
  3237.       age it, and they will tell you.
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.                                  - 50 -
  3248.  
  3249.  
  3250.  
  3251.             In fact, DNS is a giant distributed database. It is implemented by
  3252.       means  of  so-called  name  servers  that  supply information on a given
  3253.       domain or set of domains. For each zone, there are at least two, at most
  3254.       a  few, name servers that hold all authoritative information on hosts in
  3255.       that zone. To obtain the IP address of erdos, all you have to do is con-
  3256.       tact  the  name  server for the groucho.edu zone, which will then return
  3257.       the desired data.
  3258.  
  3259.  
  3260.             Easier said than done, you might think. So how do I  know  how  to
  3261.       reach  the name server at Groucho Marx University? In case your computer
  3262.       isn't equipped with an address-resolving oracle, DNS provides for  this,
  3263.       too.   When  your  application wants to look up information on erdos, it
  3264.       contacts a local name server, which conducts a so-called iterative query
  3265.       for  it.  It starts off by sending a query to a name server for the root
  3266.       domain, asking for the address of erdos.maths.groucho.edu. The root name
  3267.       server  recognizes that this name does not belong to its zone of author-
  3268.       ity, but rather to one below the edu domain. Thus, it tells you to  con-
  3269.       tact  an  edu zone name server for more information, and encloses a list
  3270.       of all edu name servers along with their  addresses.   Your  local  name
  3271.       server  will  then go on and query one of those, for instance a.isi.edu.
  3272.       In a manner similar to the root name server, a.isi.edu  knows  that  the
  3273.       groucho.edu  people  run  a  zone  of  their own, and point you to their
  3274.       servers. The local name server will then present its query for erdos  to
  3275.       one  of these, which will finally recognize the name as belonging to its
  3276.       zone, and return the corresponding IP address.
  3277.  
  3278.  
  3279.            Now, this looks like a lot of traffic being generated  for  looking
  3280.       up  a  measly IP address, but it's really only miniscule compared to the
  3281.       amount of data that would have to be transferred if we were still  stuck
  3282.       with HOSTS.TXT. But there's still room for improvement with this scheme.
  3283.  
  3284.  
  3285.            To improve response time during future  queries,  the  name  server
  3286.       will  store  the  information  obtained in its local cache.  So the next
  3287.       time anyone on your local network wants to look up the address of a host
  3288.       in  the groucho.edu domain, your name server will not have to go through
  3289.       the whole process again, but will rather  go  to  the  groucho.edu  name
  3290.       server directly.(4)
  3291.  
  3292.  
  3293.             Of course, the name server will not keep this information forever,
  3294.       but rather discard it after some period. This expiry interval is  called
  3295.       the  time  to  live,  or TTL. Each datum in the DNS database is assigned
  3296.       such a TTL by administrators of the responsible zone.
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.       
  3303.  
  3304.       4. If it didn't, then DNS would be about as bad as any other
  3305.          method, because each query would involve  the  root  name
  3306.          servers.
  3307.  
  3308.  
  3309.  
  3310.  
  3311.  
  3312.  
  3313.  
  3314.                                  - 51 -
  3315.  
  3316.  
  3317.  
  3318.       3.6.4  Domain Name Servers
  3319.  
  3320.  
  3321.  
  3322.  
  3323.            Name servers that hold all information on hosts within a  zone  are
  3324.       called  authoritative  for  this  zone, and are sometimes referred to as
  3325.       master name servers. Any query for a host within this zone will  finally
  3326.       wind down at one of these master name servers.
  3327.  
  3328.  
  3329.              To  provide a coherent picture of a zone, its master servers must
  3330.       be fairly well synchronized. This is achieved by making one of them  the
  3331.       primary  server,  which  loads its zone information from data files, and
  3332.       making the others secondary servers who transfer the zone data from  the
  3333.       primary server at regular intervals.
  3334.  
  3335.  
  3336.            One reason to have several name servers is to distribute work load,
  3337.       another is redundance. When one name server machine fails  in  a  benign
  3338.       way,  like  crashing  or losing its network connection, all queries will
  3339.       fall back to the other servers. Of course, this scheme  doesn't  protect
  3340.       you  from  server  malfunctions  that  produce  wrong replies to all DNS
  3341.       requests, e.g. from software bugs in the server program itself.
  3342.  
  3343.  
  3344.             Of course, you can also think of running a name server that is not
  3345.       authoritative for any domain.(5) This type of server is useful neverthe-
  3346.       less,  as  it  is still able to conduct DNS queries for the applications
  3347.       running on the local network, and cache the information. It is therefore
  3348.       called a caching-only server.
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.       3.6.5  The DNS Database
  3355.  
  3356.  
  3357.  
  3358.  
  3359.            We have seen above that DNS does not only deal with IP addresses of
  3360.       hosts, but also exchanges information on name  servers.   There  are  in
  3361.       fact  a  whole  bunch of different types of entries the DNS database may
  3362.       have.
  3363.  
  3364.  
  3365.             A single piece of information from the DNS database  is  called  a
  3366.       resource record, or RR for short. Each record has a type associated with
  3367.       it, describing the sort of data it represents, and  a  class  specifying
  3368.       the  type  of network it applies to. The latter accomodates the needs of
  3369.  
  3370.       
  3371.  
  3372.       5. Well,  almost. A name server at least has to provide name
  3373.          service for localhost and reverse lookups of 127.0.0.1.
  3374.  
  3375.  
  3376.  
  3377.  
  3378.  
  3379.  
  3380.  
  3381.                                  - 52 -
  3382.  
  3383.  
  3384.  
  3385.       different addressing schemes, like  IP  addresses  (the  IN  class),  or
  3386.       addresses  of Hesiod networks (used at MIT), and a few more.  The proto-
  3387.       typical resource record type is the A record which  associates  a  fully
  3388.       qualified domain name with an IP address.
  3389.  
  3390.  
  3391.              Of  course,  a  host may have more than one name. However, one of
  3392.       these names must be identified as the official, or canonical host  name,
  3393.       while the others are simply aliases referring to the former. The differ-
  3394.       ence is that the canocical host name is the one with an A record associ-
  3395.       ated,  while the others only have a record of type CNAME which points to
  3396.       the canonical host name.
  3397.  
  3398.  
  3399.            We will not go through all record types here, but save them  for  a
  3400.       later  chapter,  but rather give you a brief example here.  Figure 3.6.5
  3401.       shows a part of the domain database that is loaded into the name servers
  3402.       for the physics.groucho.edu zone.
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.              Apart  from  A and CNAME records, you can see a special record at
  3409.       the top of the file, stretching several lines. This is the SOA  resource
  3410.       record,  signalling the Start of Authority, which holds general informa-
  3411.       tion on the zone the server is authoritative for.  This  comprises,  for
  3412.       instance, the default time-to-live for all records.
  3413.  
  3414.  
  3415.            Note  that  all names in the sample file that do not end with a dot
  3416.       should be interpreted relative to the groucho.edu domain.   The  special
  3417.       name ``@'' used in the SOA record refers to the domain name by itself.
  3418.  
  3419.  
  3420.            We have seen above that the name servers for the groucho.edu domain
  3421.       somehow have to know about the physics  zone  so  that  they  can  point
  3422.       queries  to  their  name  servers. This is usually achieved by a pair of
  3423.       records: the NS record that gives the server's FQDN,  and  an  A  record
  3424.       associating  an  address  with  that  name. Since these records are what
  3425.       holds the name space together,  they  are  frequently  called  the  glue
  3426.       records.   They  are  the  only instances of records where a parent zone
  3427.       actually holds information on hosts in the subordinate zone.   The  glue
  3428.       records  pointing  to the name servers for physics.groucho.edu are shown
  3429.       in figure 3.6.5.
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.       3.6.6  Reverse Lookups
  3436.  
  3437.  
  3438.  
  3439.  
  3440.  
  3441.  
  3442.  
  3443.  
  3444.  
  3445.  
  3446.  
  3447.                                  - 53 -
  3448.  
  3449.  
  3450.  
  3451.  
  3452.  
  3453.             ;
  3454.             ; Authoritative Information on physics.groucho.edu
  3455.             @                     IN    SOA          {
  3456.                                  niels.physics.groucho.edu.
  3457.                                  hostmaster.niels.physics.groucho.edu.
  3458.                                  1034             ; serial no
  3459.                                  360000           ; refresh
  3460.                                  3600             ; retry
  3461.                                  3600000          ; expire
  3462.                                  3600             ; default ttl
  3463.                                }
  3464.             ;
  3465.             ; Name servers
  3466.                                   IN    NS       niels
  3467.                                   IN    NS       gauss.maths.groucho.edu.
  3468.             gauss.maths.groucho.edu. IN A        149.76.4.23
  3469.             ;
  3470.             ; Theoretical Physics (subnet 12)
  3471.             niels                 IN    A        149.76.12.1
  3472.                                   IN    A        149.76.1.12
  3473.             nameserver            IN    CNAME    niels
  3474.             otto                  IN    A        149.76.12.2
  3475.             quark                 IN    A        149.76.12.4
  3476.             down                  IN    A        149.76.12.5
  3477.             strange               IN    A        149.76.12.6
  3478.             ...
  3479.             ; Collider Lab. (subnet 14)
  3480.             boson                 IN    A        149.76.14.1
  3481.             muon                  IN    A        149.76.14.7
  3482.             bogon                 IN    A        149.76.14.12
  3483.             ...
  3484.  
  3485.  
  3486.  
  3487.       Figure 5.   An excerpt  from  the  named.hosts  file  for  the
  3488.                  Physics Department.
  3489.  
  3490.  
  3491.            Beside  looking  up the IP address belonging to a host, it is some-
  3492.       times desirable to find out the canonical host name corresponding to  an
  3493.       address.   This is called reverse mapping and is used by several network
  3494.       services to verify a client's identity. When using a single hosts  file,
  3495.       reverse  lookups  simply involve searching the file for a host that owns
  3496.       the IP address in question. With DNS, an exhaustive search of  the  name
  3497.       space is out of the question, of course.  Instead, a special domain, in-
  3498.       addr.arpa, has been created which contains the IP addresses of all hosts
  3499.       in  a  reverted  dotted-quad  notation.  For  instance, an IP address of
  3500.       149.76.12.4  corresponds  to  the  name  4.12.76.149.in-addr.arpa.   The
  3501.       resource  record  type linking these names to their canonical host names
  3502.       is PTR.
  3503.  
  3504.  
  3505.  
  3506.  
  3507.  
  3508.  
  3509.  
  3510.  
  3511.  
  3512.  
  3513.                                  - 54 -
  3514.  
  3515.  
  3516.  
  3517.  
  3518.  
  3519.             ;
  3520.             ; Zone data for the groucho.edu zone.
  3521.             @                   IN       SOA          {
  3522.                                  vax12.gcc.groucho.edu.
  3523.                                  hostmaster.vax12.gcc.groucho.edu.
  3524.                                  233              ; serial no
  3525.                                  360000           ; refresh
  3526.                                  3600             ; retry
  3527.                                  3600000          ; expire
  3528.                                  3600             ; default ttl
  3529.                                }
  3530.             ....
  3531.             ;
  3532.             ; Glue records for the physics.groucho.edu zone
  3533.             physics             IN     NS        niels.physics.groucho.edu.
  3534.                                 IN     NS        gauss.maths.groucho.edu.
  3535.             niels.physics       IN     A         149.76.12.1
  3536.             gauss.maths         IN     A         149.76.4.23
  3537.             ...
  3538.  
  3539.  
  3540.  
  3541.       Figure 6.   An excerpt from the named.hosts file for GMU.
  3542.  
  3543.  
  3544.             Creating a zone of authority usually means that its administrators
  3545.       are  given  full control over how they assign addresses to names.  Since
  3546.       they usually have one or more IP networks or  subnets  at  their  hands,
  3547.       there's  a  one-to-many  mapping  between DNS zones and IP networks. The
  3548.       Physics Department, for  instance,  comprises  the  subnets  149.76.8.0,
  3549.       149.76.12.0, and 149.76.14.0.
  3550.  
  3551.  
  3552.            As  a  consequence, new zones in the in-addr.arpa domain have to be
  3553.       created along with the physics zone and delegated to the network  admin-
  3554.       istrators   at   the  department:  8.76.149.in-addr.arpa,  12.76.149.in-
  3555.       addr.arpa,  and 14.76.149.in-addr.arpa.   Otherwise,  installing  a  new
  3556.       host  at  the  Collider  Lab  would require them to contact their parent
  3557.       domain to have the new address  entered  into  their  in-addr.arpa  zone
  3558.       file.
  3559.  
  3560.  
  3561.            The zone database for subnet 12 is shown in figure 3.6.6.  The cor-
  3562.       responding glue records in the database of their parent zone is shown in
  3563.       figure 3.6.6.
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.  
  3572.  
  3573.  
  3574.  
  3575.  
  3576.  
  3577.  
  3578.  
  3579.                                  - 55 -
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.             ;
  3586.             ; the 12.76.149.in-addr.arpa domain.
  3587.             @                IN     SOA   {
  3588.                                  niels.physics.groucho.edu.
  3589.                                  hostmaster.niels.physics.groucho.edu.
  3590.                                  233 360000 3600 3600000 3600
  3591.                                }
  3592.             2                IN     PTR       otto.physics.groucho.edu.
  3593.             4                IN     PTR       quark.physics.groucho.edu.
  3594.             5                IN     PTR       down.physics.groucho.edu.
  3595.             6                IN     PTR       strange.physics.groucho.edu.
  3596.  
  3597.  
  3598.  
  3599.       Figure 7.   An excerpt from the named.rev file for subnet  12.
  3600.  
  3601.  
  3602.  
  3603.  
  3604.             ;
  3605.             ; the 76.149.in-addr.arpa domain.
  3606.             @                   IN       SOA          {
  3607.                                  vax12.gcc.groucho.edu.
  3608.                                  hostmaster.vax12.gcc.groucho.edu.
  3609.                                  233 360000 3600 3600000 3600
  3610.                                }
  3611.             ...
  3612.             ; subnet 4: Mathematics Dept.
  3613.             1.4              IN     PTR      sophus.maths.groucho.edu.
  3614.             17.4             IN     PTR      erdos.maths.groucho.edu.
  3615.             23.4             IN     PTR      gauss.maths.groucho.edu.
  3616.             ...
  3617.             ; subnet 12: Physics Dept, separate zone
  3618.             12               IN     NS       niels.physics.groucho.edu.
  3619.                              IN     NS       gauss.maths.groucho.edu.
  3620.             niels.physics.groucho.edu. IN  A 149.76.12.1
  3621.             gauss.maths.groucho.edu. IN  A   149.76.4.23
  3622.             ...
  3623.  
  3624.  
  3625.  
  3626.       Figure 8.    An  excerpt  from  the named.rev file for network
  3627.                  149.76.
  3628.  
  3629.  
  3630.             One important consequence of this is that zones can only  be  cre-
  3631.       ated as supersets of IP networks, and, even more severe, that these net-
  3632.       work's netmasks have to be on byte boundaries. All  subnets  at  Groucho
  3633.       Marx  University have a netmask of 255.255.255.0, whence an in-addr.arpa
  3634.       zone could be created for each  subnet.  However,  if  the  netmask  was
  3635.       255.255.255.128  instead,  creating  zones  for the subnet 149.76.12.128
  3636.       would be impossible, because  there's  no  way  to  tell  DNS  that  the
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.                                  - 56 -
  3646.  
  3647.  
  3648.  
  3649.       12.76.149.in-addr.arpa  domain has been split in two zones of authority,
  3650.       with host names ranging from 1 through 127, and 128 through 255, respec-
  3651.       tively.
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.  
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.  
  3704.  
  3705.  
  3706.  
  3707.  
  3708.  
  3709.  
  3710.  
  3711.                                  - 57 -
  3712.  
  3713.  
  3714.  
  3715.       4.  Configuring the Networking Hardware
  3716.  
  3717.  
  3718.  
  3719.  
  3720.       4.1  Devices, Drivers, and all that
  3721.  
  3722.  
  3723.  
  3724.  
  3725.            Up  to now, we've been talking quite a bit about network interfaces
  3726.       and general TCP/IP issues, but didn't really cover exactly what  happens
  3727.       when ``the networking code'' in the kernel accesses a piece of hardware.
  3728.       For this, we have to talk a little about the concept of  interfaces  and
  3729.       drivers.
  3730.  
  3731.  
  3732.            First,  of course, there's the hardware itself, for example an Eth-
  3733.       ernet board: this is a slice of Epoxy, cluttered with lots of tiny chips
  3734.       with  silly numbers on them, sitting in a slot of your PC.  This is what
  3735.       we generally call a device.
  3736.  
  3737.  
  3738.            For you to be able to use the  Ethernet  board,  special  functions
  3739.       have  to  be present in your Linux kernel that understand the particular
  3740.       way this device is accessed. These are  the  so-called  device  drivers.
  3741.       For  example,  Linux  has  device drivers for several brands of Ethernet
  3742.       boards that are very  similar  in  function.   They  are  known  as  the
  3743.       ``Becker  Series  Drivers'',  named after their author, Donald Becker. A
  3744.       different example is the D-Link driver  that  handles  a  D-Link  pocket
  3745.       adaptor attached to a parallel port.
  3746.  
  3747.  
  3748.            But,  what  do  we  mean when we say a driver ``handles'' a device?
  3749.       Let's go back to that Ethernet board we examined above. The  driver  has
  3750.       to  be able to communicate with the peripheral's on-board logic somehow:
  3751.       it has to send commands and data to the board, while  the  board  should
  3752.       deliver any data received to the driver.
  3753.  
  3754.  
  3755.            In  PCs, this communication takes place through an area of I/O mem-
  3756.       ory that is mapped to on-board registers and the like.  All commands and
  3757.       data  the  kernel sends to the board have to go through these registers.
  3758.       I/O memory is  generally  described  by  giving  its  starting  or  base
  3759.       address. Typical base addresses for Ethernet boards are 0x300, or 0x360.
  3760.  
  3761.  
  3762.            Usually, you don't have to worry about any hardware issues such  as
  3763.       the  base  address,  because the kernel makes an attempt at boot time to
  3764.       detect a board's location. This is called autoprobing, which means  that
  3765.       the  kernel  reads  several  memory locations and compares the data read
  3766.       with what it should see if a certain Ethernet board was installed.  How-
  3767.       ever,  there may be Ethernet boards it cannot detect automatically; this
  3768.       is sometimes the case with  cheap  Ethernet  cards  that  are  not-quite
  3769.  
  3770.  
  3771.  
  3772.  
  3773.  
  3774.  
  3775.  
  3776.  
  3777.                                  - 58 -
  3778.  
  3779.  
  3780.  
  3781.       clones  of  standard  boards from other manufacturers.  Also, the kernel
  3782.       will attempt to detect only one Ethernet device when booting. If  you're
  3783.       using  more than one board, you have to tell the kernel about this board
  3784.       explicitly.
  3785.  
  3786.  
  3787.             Another such parameter that you might  have  to  tell  the  kernel
  3788.       about  is  the  interrupt  request channel.  Hardware components usually
  3789.       interrupt the kernel when they need care taken of them, e.g.  when  data
  3790.       has  arrived,  or  a  special  condition occurs. In a PC, interrupts may
  3791.       occur on one of 15 interrupt channels numbered 0, 1, and 3  through  15.
  3792.       The  interrupt  number  assigned  to  a hardware component is called its
  3793.       interrupt request number, or IRQ.(1)
  3794.  
  3795.  
  3796.             As described in chapter 3., the kernel accesses a device through a
  3797.       so-called interface.  Interfaces offer an abstract set of functions that
  3798.       is the same across all types of hardware, such as sending or receiving a
  3799.       datagram.
  3800.  
  3801.  
  3802.            Interfaces  are  identified  by  means  of  names.  These are names
  3803.       defined internally in the kernel, and are not device files in  the  /dev
  3804.       directory.   Typical names are eth0, eth1, etc, for Ethernet interfaces.
  3805.       The assignment of interfaces to devices usually depends on the order  in
  3806.       which  devices  are  configured;  for  instance the first Ethernet board
  3807.       installed will become eth0, the next will be eth1, and so on. One excep-
  3808.       tion from this rule are SLIP interfaces, which are assigned dynamically;
  3809.       that is, whenever a SLIP connection  is  established,  an  interface  is
  3810.       assigned to the serial port.
  3811.  
  3812.  
  3813.            The picture given in figure  tries to show the relationship between
  3814.       the hardware, device drivers and interfaces.
  3815.  
  3816.  
  3817.            When booting, the kernel displays what devices it detects, and what
  3818.       interfaces  it  installs.  The following is an excerpt of a typical boot
  3819.       screen:
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.       
  3832.  
  3833.       1. IRQs 2 and 9 are the same because the PC has two cascaded
  3834.          interrupt  processors with eight IRQs each; the secondary
  3835.          processor is connected to IRQ 2 of the primary one.
  3836.  
  3837.  
  3838.  
  3839.  
  3840.  
  3841.  
  3842.  
  3843.                                  - 59 -
  3844.  
  3845.  
  3846.  
  3847.             .
  3848.             .
  3849.            This processor honours the WP bit even when in supervisor mode. Good.
  3850.            Floppy drive(s): fd0 is 1.44M
  3851.            Swansea University Computer Society NET3.010
  3852.            IP Protocols: ICMP, UDP, TCP
  3853.            PPP: version 0.2.1 (4 channels) OPTIMIZE FLAGS
  3854.            TCP compression code copyright 1989 Regents of the University of California
  3855.            PPP line discipline registered.
  3856.            SLIP: version 0.7.5 (4 channels)
  3857.            CSLIP: code copyright 1989 Regents of the University of California
  3858.            dl0: D-Link DE-600 pocket adapter, Ethernet Address: 00:80:C8:71:76:95
  3859.            Checking 386/387 coupling... Ok, fpu using exception 16 error reporting.
  3860.            Linux version 1.1.11 (okir@monad) #3 Sat May 7 14:57:18 MET DST 1994
  3861.  
  3862.  
  3863.  
  3864.  
  3865.            This  shows  that the kernel has been compiled with TCP/IP enabled,
  3866.       and drivers for SLIP, CSLIP, and PPP  included.   The  third  line  from
  3867.       below  says  that a D-Link pocket adaptor was detected, and installed as
  3868.       interface dl0.  If you have a different type of Ethernet card, the  ker-
  3869.       nel  will  usually print a line starting with eth0, followed by the type
  3870.       of card detected.  If you have an Ethernet card installed but don't  see
  3871.       any  such  message,  this means that the kernel is unable to detect your
  3872.       board properly.  This is dealt with in a later section.
  3873.  
  3874.  
  3875.       4.2  Kernel Configuration
  3876.  
  3877.       Most Linux distributions come along with boot disks that  work  for  all
  3878.       common  types of PC hardware.  This means that the kernel on those disks
  3879.       has all sorts of drivers configured in that you  will  never  need,  but
  3880.       which waste precious system memory because parts of the kernel cannot be
  3881.       swapped out. Therefore, you will generally roll your own kernel, includ-
  3882.       ing only those drivers you actually need or want.
  3883.  
  3884.  
  3885.            When running a Linux system, you should be familiar with building a
  3886.       kernel. The basics of this are explained in Matt Welsh's  ``Installation
  3887.       and  Getting Started'' Guide, which is also part of the Linux Documenta-
  3888.       tion Project's series.  In this section, we will therefore discuss  only
  3889.       those configuration options that affect networking.
  3890.  
  3891.  
  3892.            When  running make config, you will first be asked general configu-
  3893.       rations, for instance whether you want kernel  math  emulation  or  not,
  3894.       etc.  One  of these asks you whether you want TCP/IP networking support.
  3895.       You must answer this with y to get a kernel capable of networking.
  3896.  
  3897.  
  3898.       4.2.1  Kernel Options in Linux 1.0 and Higher
  3899.  
  3900.  
  3901.  
  3902.  
  3903.  
  3904.  
  3905.  
  3906.  
  3907.  
  3908.  
  3909.                                  - 60 -
  3910.  
  3911.  
  3912.  
  3913.            After the general option part is complete, the  configuration  will
  3914.       go  on  to  ask  you for various features such as SCSI drivers, etc. The
  3915.       subsequent list questions deal with networking support. The exact set of
  3916.       configuration  options is in constant flux because of the ongoing devel-
  3917.       opment. A typical list of options offered by most kernel versions around
  3918.       1.0 and 1.1 looks like this (comments are given in italics):
  3919.  
  3920.  
  3921.  
  3922.            *
  3923.            * Network device support
  3924.            *
  3925.            Network device support? (CONFIG ETHERCARDS) [y]
  3926.  
  3927.  
  3928.  
  3929.  
  3930.            Despite the macro name displayed in brackets, you must answer  this
  3931.       question  with  y  if  you  want  to use any type of networking devices,
  3932.       regardless of whether this is Ethernet, SLIP, or  PPP.   When  answering
  3933.       this question with y, support for Ethernet-type devices is enabled auto-
  3934.       matically.  Support for other types of network drivers must  be  enabled
  3935.       separately:
  3936.  
  3937.  
  3938.  
  3939.            SLIP (serial line) support? (CONFIG SLIP) [y]
  3940.             SLIP compressed headers (SL COMPRESSED) [y]
  3941.            PPP (point-to-point) support (CONFIG PPP) [y]
  3942.            PLIP (parallel port) support (CONFIG PLIP) [n]
  3943.  
  3944.  
  3945.  
  3946.  
  3947.            These questions concern the various link layer protocols  supported
  3948.       by  Linux.   SLIP  allows  you  to  transport IP datagrams across serial
  3949.       lines.  The compressed header option provides support for CSLIP, a tech-
  3950.       nique  that compresses TCP/IP headers to as little as three bytes.  Note
  3951.       that this kernel option does not turn on CSLIP automatically, it  merely
  3952.       provides the necessary kernel functions for it.
  3953.  
  3954.  
  3955.            PPP  is  another  protocol  to  send  network traffic across serial
  3956.       lines.  It is much more flexible than SLIP, and is not  limited  to  IP,
  3957.       but  will  also  support IPX once it is implemented.  As PPP support has
  3958.       been completed only lately, this option may not be present in your  ker-
  3959.       nel.
  3960.  
  3961.  
  3962.            PLIP provides for a way to send IP datagrams across a parallel port
  3963.       connection.  It is mostly used to communicate with PCs running DOS.
  3964.  
  3965.  
  3966.            The following questions deal  with  Ethernet  boards  from  various
  3967.  
  3968.  
  3969.  
  3970.  
  3971.  
  3972.  
  3973.  
  3974.  
  3975.                                  - 61 -
  3976.  
  3977.  
  3978.  
  3979.       vendors.   As  more  drivers  are being developed, you are likely to see
  3980.       questions added to this section.  If you want to build a kernel you  can
  3981.       use  on  a  number  of  different machines, you can enable more than one
  3982.       driver.
  3983.  
  3984.  
  3985.  
  3986.            NE2000/NE1000 support (CONFIG NE2000) [y]
  3987.            WD80*3 support (CONFIG WD80x3) [n]
  3988.            SMC Ultra support (CONFIG ULTRA) [n]
  3989.            3c501 support (CONFIG EL1) [n]
  3990.            3c503 support (CONFIG EL2) [n]
  3991.            3c509/3c579 support (CONFIG EL3) [n]
  3992.            HP PCLAN support (CONFIG HPLAN) [n]
  3993.            AT1500 and NE2100 (LANCE and PCnet-ISA) support (CONFIG LANCE) [n]
  3994.            AT1700 support (CONFIG AT1700) [n]
  3995.            DEPCA support (CONFIG DEPCA) [n]
  3996.            D-Link DE600 pocket adaptor support (CONFIG DE600) [y]
  3997.            AT-LAN-TEC/RealTek pocket adaptor support (CONFIG ATP) [n]
  3998.            *
  3999.            * CD-ROM drivers
  4000.            *
  4001.             ...
  4002.  
  4003.  
  4004.  
  4005.  
  4006.              Finally, in the filesystem section, the configuration script will
  4007.       ask you whether you want support for  NFS,  the  networking  filesystem.
  4008.       NFS  lets you export filesystems to several hosts, which makes the files
  4009.       appear as if they were on an ordinary hard disk attached to the host.
  4010.  
  4011.  
  4012.  
  4013.            NFS filesystem support (CONFIG NFS FS) [y]
  4014.  
  4015.  
  4016.  
  4017.  
  4018.       4.2.2  Kernel Options in Linux 1.1.14 and Higher
  4019.  
  4020.       Starting with Linux 1.1.14, which added alpha support for IPX, the  con-
  4021.       figuration  procedure  changed slightly. The general options section now
  4022.       asks whether you want networking support in general. It  is  immediately
  4023.       followed by a couple of question on miscellaneous networking options.
  4024.  
  4025.  
  4026.  
  4027.            *
  4028.            * Networking options
  4029.            *
  4030.            TCP/IP networking (CONFIG INET) [y]
  4031.  
  4032.  
  4033.  
  4034.  
  4035.  
  4036.  
  4037.  
  4038.  
  4039.  
  4040.  
  4041.                                  - 62 -
  4042.  
  4043.  
  4044.  
  4045.            To use TCP/IP networking, you must answer this question with y.  If
  4046.       you answer with n, however, you will still be able to compile the kernel
  4047.       with IPX support.
  4048.  
  4049.  
  4050.  
  4051.            IP forwarding/gatewaying (CONFIG IP FORWARD) [n]
  4052.  
  4053.  
  4054.  
  4055.  
  4056.             You have to enable this option if your system acts  as  a  gateway
  4057.       between  two  Ethernets,  or  between and Ethernet and a SLIP link, etc.
  4058.       Although it doesn't hurt to enable this by default, you may want to dis-
  4059.       able  this  to  configure  a host as a so-called firewall. Firewalls are
  4060.       hosts that are connected to two or more networks, but don't route  traf-
  4061.       fic  between  them.  They are commonly used to provide users from a com-
  4062.       pany network with Internet access at a minimal risk to the internal net-
  4063.       work.  Users  will  be allowed to log into the firewall and use Internet
  4064.       services, but the company's machines  will  be  protected  from  outside
  4065.       attacks because any incoming connections can't cross the firewall.
  4066.  
  4067.  
  4068.  
  4069.            *
  4070.            * (it is safe to leave these untouched)
  4071.            *
  4072.            PC/TCP compatibility mode (CONFIG INET PCTCP) [n]
  4073.  
  4074.  
  4075.  
  4076.  
  4077.              This option works around an incompatibility with some versions of
  4078.       PC/TCP, a commercial TCP/IP implementation for  DOS-based  PCs.  If  you
  4079.       enable  this  option,  you will still be able to communicate with normal
  4080.       Un*x machines, but performance may be hurt over slow links.
  4081.  
  4082.  
  4083.  
  4084.            Reverse ARP (CONFIG INET RARP) [n]
  4085.  
  4086.  
  4087.  
  4088.  
  4089.             This function enables RARP, the Reverse Address Resolution  Proto-
  4090.       col.  RARP  is used by diskless clients and X terminals to inquire their
  4091.       IP address when booting.  You should enable RARP only when you  plan  to
  4092.       serve  this  sort  of  clients.  The latest package of network utilities
  4093.       (net-0.32d) contains a small utility named rarp that allows you  to  add
  4094.       systems to the RARP cache.
  4095.  
  4096.  
  4097.  
  4098.  
  4099.  
  4100.  
  4101.  
  4102.  
  4103.  
  4104.  
  4105.  
  4106.  
  4107.                                  - 63 -
  4108.  
  4109.  
  4110.  
  4111.            Assume subnets are local (CONFIG INET SNARL) [y]
  4112.  
  4113.  
  4114.  
  4115.  
  4116.              When sending data over TCP, the kernel has to break up the stream
  4117.       into several packets before giving it to  IP.  For  hosts  that  can  be
  4118.       reached over a local network such as an Ethernet, larger packets will be
  4119.       used than for hosts where data has to go through long-distance links.(2)
  4120.       If you don't enable SNARL, the kernel will assume  only  those  networks
  4121.       are  local that it actually has an interface to. However, if you look at
  4122.       the class B network at Groucho Marx University, the whole class  B  net-
  4123.       work  is  local, but most hosts interface to only one or two subnets. If
  4124.       you enable SNARL, the kernel will assume all subnets are local  and  use
  4125.       large packets when talking to all hosts on campus.
  4126.  
  4127.  
  4128.            If  you  do  want to use smaller packet sizes for data sent to spe-
  4129.       cific hosts (because, for instance, the data goes through a SLIP  link),
  4130.       you  can do so using the mtu option of route, which is briefly discussed
  4131.       at the end of this chapter.
  4132.  
  4133.  
  4134.  
  4135.            Disable NAGLE algorithm (normally enabled) (CONFIG TCP NAGLE OFF) [n]
  4136.  
  4137.  
  4138.  
  4139.  
  4140.             Nagle's rule is a heuristic to avoid sending particularly small IP
  4141.       packets, also called tinygrams. Tinygrams are usually created by  inter-
  4142.       active  networking tools that transmit single keystrokes, such as telnet
  4143.       or rsh. Tinygrams can  become  particularly  wasteful  on  low-bandwidth
  4144.       links  like SLIP.  The Nagle algorithm attempts to avoid them by holding
  4145.       back transmission of TCP data  briefly  under  some  circumstances.  You
  4146.       might only want to disable Nalge's algorithm if you have severe problems
  4147.       with packets getting dropped.
  4148.  
  4149.  
  4150.  
  4151.            The IPX protocol (CONFIG IPX) [n]
  4152.  
  4153.  
  4154.  
  4155.  
  4156.             This enables support for IPX, the transport protocol used by  Nov-
  4157.       ell  Networking.  It is still under development, and isn't really useful
  4158.       yet. One benefit of this will be that you can exchange  data  with  IPX-
  4159.       based DOS utilities one day, and route traffic between your Novell-based
  4160.       networks through a PPP link.  Support for the  high-level  protocols  of
  4161.       Novell  networking  is  however  not in sight, as the specifications for
  4162.  
  4163.       
  4164.  
  4165.       2. This  is to avoid fragmentation by links that have a very
  4166.          small maximum packet size.
  4167.  
  4168.  
  4169.  
  4170.  
  4171.  
  4172.  
  4173.  
  4174.                                  - 64 -
  4175.  
  4176.  
  4177.  
  4178.       these are available only at horrendous cost and under  a  non-disclosure
  4179.       agreement.
  4180.  
  4181.  
  4182.            Starting  in the 1.1.16 kernel, Linux supports another driver type,
  4183.       the dummy driver.  The following question appears toward  the  start  of
  4184.       the device driver section.
  4185.  
  4186.  
  4187.  
  4188.            Dummy net driver support (CONFIG DUMMY) [y]
  4189.  
  4190.  
  4191.  
  4192.  
  4193.            The  dummy  driver  doesn't  really do much, but is quite useful on
  4194.       standalone or SLIP hosts.  It is basically a masqueraded loopback inter-
  4195.       face. The reason to have this sort of interface is that on hosts that do
  4196.       SLIP but have no Ethernet, you want to have an interface that bears your
  4197.       IP  address  all the time.  This is discussed in a little more detail in
  4198.       section 6.7.7 in chapter 6..
  4199.  
  4200.  
  4201.       4.3  A Tour of Linux Network Devices
  4202.  
  4203.       The Linux kernel supports a number of hardware drivers for various types
  4204.       of equipment. This section gives a short overview of the driver families
  4205.       available, and the interface names used for them.
  4206.  
  4207.  
  4208.             There are a number of standard  names  for  interfaces  in  Linux,
  4209.       which are listed below. Most drivers support more than one interface, in
  4210.       which case the interfaces are numbered, as in eth0, eth1, etc.
  4211.  
  4212.  
  4213.  
  4214.  
  4215.              lo  The local loopback interface. It is  used  for  testing  pur-
  4216.                 poses,  as  well as a couple of network applications. It works
  4217.                 like a closed circuit in that any datagram written to it  will
  4218.                 be  immediately  returned  to  the  host's  networking  layer.
  4219.                 There's always one loopback device present in the kernel,  and
  4220.                 there's little sense in having fewer or more.
  4221.  
  4222.  
  4223.            ethn   The  n-th  Ethernet card. This is the generic interface name
  4224.                 for most Ethernet boards.
  4225.  
  4226.  
  4227.             dln  These interfaces  access  a  D-Link  DE-600  pocket  adapter,
  4228.                 another  Ethernet  device.  It is a little special in that the
  4229.                 DE-600 is driven through a parallel port.
  4230.  
  4231.  
  4232.  
  4233.  
  4234.  
  4235.  
  4236.  
  4237.  
  4238.  
  4239.  
  4240.                                  - 65 -
  4241.  
  4242.  
  4243.  
  4244.             sln  The n-th SLIP interface. SLIP interfaces are associated  with
  4245.                 serial  lines  in  the  order  in which they are allocated for
  4246.                 SLIP; i.e., the first serial line being  configured  for  SLIP
  4247.                 becomes  sl0,  etc. The kernel supports up to four SLIP inter-
  4248.                 faces.
  4249.  
  4250.  
  4251.            pppn  The n-th PPP interface. Just  like  SLIP  interfaces,  a  PPP
  4252.                 interface  is  associated  with  a serial line once it is con-
  4253.                 verted to PPP mode. At the moment, up to four  interfaces  are
  4254.                 supported.
  4255.  
  4256.  
  4257.           plipn   The  n-th  PLIP interface. PLIP transports IP datagrams over
  4258.                 parallel lines. Up to three  PLIP  interfaces  are  supported.
  4259.                 They are allocated by the PLIP driver at system boot time, and
  4260.                 are mapped onto parallel ports.
  4261.  
  4262.  
  4263.  
  4264.  
  4265.  
  4266.             For other interface drivers that may be added in the future,  like
  4267.       ISDN,  or  AX.25,  other names will be introduced. Drivers for IPX (Nov-
  4268.       ell's networking protocol), and AX.25 (used by ham radio  amateurs)  are
  4269.       under development, but are at alpha stage still.
  4270.  
  4271.  
  4272.            During the following sections, we will discuss the details of using
  4273.       the drivers described above.
  4274.  
  4275.  
  4276.       4.4  Ethernet Installation
  4277.  
  4278.  
  4279.  
  4280.  
  4281.            The current Linux network code supports various brands of  Ethernet
  4282.       cards.  Most  drivers  were written by Donald Becker (becker@super.org),
  4283.       who authored a family of drivers for cards based on the  National  Semi-
  4284.       conductor  8390  chip;  these  have  become  known  as the Becker Series
  4285.       Drivers.  There are also drivers for a couple of products  from  D-Link,
  4286.       among them the D-Link pocket adaptor that allows you to access an Ether-
  4287.       net through a parallel port. The driver for this  was  written  by  Bjrn
  4288.       Ekwall  (bj0rn@blox.se). The DEPCA driver was written by David C. Davies
  4289.       (davies@wanton.lkg.dec.com).
  4290.  
  4291.  
  4292.       4.4.1  Ethernet Cabling
  4293.  
  4294.  
  4295.  
  4296.  
  4297.            If you're installing an Ethernet for the first time in your life, a
  4298.  
  4299.  
  4300.  
  4301.  
  4302.  
  4303.  
  4304.  
  4305.  
  4306.                                  - 66 -
  4307.  
  4308.  
  4309.  
  4310.       few words about the cabling may be in order here. Ethernet is very picky
  4311.       about proper cabling. The cable must be terminated on both ends  with  a
  4312.       50  Ohm  resistor, and you must not have any branches (i.e. three cables
  4313.       connected in a star-shape). If you are using a thin coax cable  with  T-
  4314.       shaped  BNC  junctions,  these  junctions must be twisted on the board's
  4315.       connector directly; you should not insert a cable segment.
  4316.  
  4317.  
  4318.            If you connect to a thicknet installation, you have to attach  your
  4319.       host  through a transceiver (sometimes called Ethernet Attachment Unit).
  4320.       You can plug the transceiver into the 25-pin  AUI  port  on  your  board
  4321.       directly, but may also use a shielded cable.
  4322.  
  4323.  
  4324.       4.4.2  Supported Boards
  4325.  
  4326.        A complete list of supported boards is available in the Ethernet HOWTOs
  4327.       posted monthly to comp.os.linux.announce by Paul Gortmaker.(3)
  4328.  
  4329.  
  4330.            Here's a list of the more widely-known boards supported  by  Linux.
  4331.       The  actual list in the HOWTO is about three times longer. However, even
  4332.       if you find your board in this list, check the HOWTO  first;  there  are
  4333.       sometimes important details about operating these cards. A case in point
  4334.       is the case of some DMA-based Ethernet boards  that  use  the  same  DMA
  4335.       channel  as the Adaptec 1542 SCSI controller by default. Unless you move
  4336.       either of them to a different DMA channel, you will  wind  up  with  the
  4337.       Ethernet  board  writing packet data to arbitrary locations on your hard
  4338.       disk.
  4339.  
  4340.  
  4341.  
  4342.  
  4343.       3Com EtherLink Both 3c503 and 3c503/16 are supported, as are  3c507  and
  4344.                 3c509.   The  3c501  is  supported, too, but is too slow to be
  4345.                 worth buying.
  4346.  
  4347.  
  4348.       Novell Eagle NE1000 and NE2000, and a  variety  of  clones.  NE1500  and
  4349.                 NE2100 are supported, too.
  4350.  
  4351.  
  4352.       Western Digital/SMC WD8003  and  WD8013 (same as SMC Elite and SMC Elite
  4353.                 Plus) are supported, and also the newer SMC Elite 16 Ultra.
  4354.  
  4355.  
  4356.       Hewlett Packard HP 27252, HP 27247B, and HP J2405A.
  4357.  
  4358.  
  4359.          D-Link DE-600 pocket adaptor, DE-100, DE-200, and DE-220-T.   There's
  4360.                 also a patch kit for the DE-650-T, which is a PCMCIA card.(4)
  4361.  
  4362.  
  4363.             DEC DE200 (32K/64K), DE202, DE100, and DEPCA rev E.
  4364.  
  4365.  
  4366.       Allied Teliesis AT1500 and AT1700.
  4367.  
  4368.  
  4369.  
  4370.  
  4371.  
  4372.                                  - 67 -
  4373.  
  4374.  
  4375.  
  4376.            To use one of these cards with Linux, you  may  use  a  precompiled
  4377.       kernel  from  one of the major Linux distributions. These generally have
  4378.       drivers for all of them built in. In the long term, however, it's better
  4379.       to  roll  your own kernel and compile in only those drivers you actually
  4380.       need.
  4381.  
  4382.  
  4383.       4.4.3  Ethernet Autoprobing
  4384.  
  4385.  
  4386.  
  4387.  
  4388.            At boot time, the Ethernet code will try to locate your  board  and
  4389.       determine  its type. Cards are probed for at the following addresses and
  4390.       in the following order:
  4391.  
  4392.  
  4393.       ------------------------------------------------------
  4394.       +--------------+-------------------------------------+
  4395.       |Board         | Addresses probed for                |
  4396.       +--------------+-------------------------------------+
  4397.       |WD/SMC        | 0x300, 0x280, 0x380, 0x240          |
  4398.       |SMC 16 Ultra  | 0x300, 0x280                        |
  4399.       |3c501         | 0x280                               |
  4400.       |3c503         | 0x300, 0x310, 0x330, 0x350, 0x250,  |
  4401.       |              | 0x280, 0x2a0, 0x2e0                 |
  4402.       |NEx000        | 0x300, 0x280, 0x320, 0x340, 0x360   |
  4403.       |HP            | 0x300, 0x320, 0x340, 0x280, 0x2C0,  |
  4404.       |              | 0x200, 0x240                        |
  4405.       |DEPCA         | 0x300, 0x320, 0x340, 0x360          |
  4406.       +--------------+-------------------------------------+
  4407.       +--------------+-------------------------------------+
  4408.  
  4409.            There are two limitations to the autoprobing code. For one, it  may
  4410.       not  recognize  all boards properly. This is especially true for some of
  4411.       the cheaper clones of common boards, but also for  some  WD80x3  boards.
  4412.       The  second problem is that the kernel will not auto-probe for more than
  4413.       one board at the moment. This is a feature, because it  is  assumed  you
  4414.       want to have control about which board is assigned which interface.
  4415.  
  4416.  
  4417.            If  you  are  using more than one board, or if the autoprobe should
  4418.       fail to detect your board, you have to tell the kernel explicitly  about
  4419.       the card's base address and name.
  4420.  
  4421.  
  4422.              In  Net-3,  you  have can use two different schemes to accomplish
  4423.       this.   One   way   is   to   change   or   add   information   in   the
  4424.       drivers/net/Space.c  file  in  the  kernel source code that contains all
  4425.       information about drivers. This is recommended only if you are  familiar
  4426.  
  4427.       
  4428.  
  4429.       3. Paul can be reached at gpg109@rsphysse.anu.edu.au.
  4430.       4. It can be gotten -- along with other Laptop-related stuff
  4431.          -- from tsx-11.mit.edu in packages/laptops.
  4432.  
  4433.  
  4434.  
  4435.  
  4436.  
  4437.  
  4438.  
  4439.                                  - 68 -
  4440.  
  4441.  
  4442.  
  4443.       with  the  networking  code.  A much better way is to provide the kernel
  4444.       with this information at boot time.  If you use lilo to boot  your  sys-
  4445.       tem,  you  can  pass parameters to the kernel by specifying them through
  4446.       the append option in lilo.conf. To inform the kernel about  an  Ethernet
  4447.       device, you can pass the following parameter:
  4448.  
  4449.  
  4450.            ether=irq,base addr,param1,param2,name
  4451.  
  4452.  
  4453.  
  4454.  
  4455.            The  first  four  parameters  are  numerical, while the last is the
  4456.       device name. All numerical values are optional; if they are  omitted  or
  4457.       set  to zero, the kernel will try to detect the value by probing for it,
  4458.       or use a default value.
  4459.  
  4460.  
  4461.             The first parameter sets  the  IRQ  assigned  to  the  device.  By
  4462.       default,  the  kernel  will try to auto-detect the device's IRQ channel.
  4463.       The 3c503 driver has a special feature that selects a free IRQ from  the
  4464.       list 5, 9, 3, 4, and configures the board to use this line.
  4465.  
  4466.  
  4467.            The  base addr parameter gives the I/O base address of the board; a
  4468.       value of zero tells the kernel to probe the addresses listed above.
  4469.  
  4470.  
  4471.            The remaining two parameters may be used differently  by  different
  4472.       drivers. For shared-memory boards such as the WD80x3, they specify start
  4473.       and end addresses of the shared memory area. Other  cards  commonly  use
  4474.       param1  to  set  the  level  of debugging information that is being dis-
  4475.       played. Values of 1 through 7 denote  increasing  levels  of  verbosity,
  4476.       while  8  turns  them  off altogether; 0 denotes the default.  The 3c503
  4477.       driver uses param2 to select the internal transceiver  (default)  or  an
  4478.       external  transceiver  (a  value  of 1). The former uses the board's BNC
  4479.       connector; the latter uses its AUI port.
  4480.  
  4481.  
  4482.            If you have two Ethernet boards, you can have Linux autodetect  one
  4483.       board,  and  pass the second board's parameters with lilo.  However, you
  4484.       must make sure the driver doesn't accidentally  find  the  second  board
  4485.       first,  else  the  other  one won't be registered at all. You do this by
  4486.       passing lilo a reserve option, which  explicitly  tells  the  kernel  to
  4487.       avoid probing the I/O space taken up by the second board.
  4488.  
  4489.  
  4490.            For  instance,  to  make  Linux  install a second Ethernet board at
  4491.       0x300 as eth1, you would pass the following parameters to the kernel:
  4492.  
  4493.  
  4494.            reserve=0x300,32 ether=0,0x300,eth1
  4495.  
  4496.  
  4497.  
  4498.  
  4499.  
  4500.  
  4501.  
  4502.  
  4503.  
  4504.  
  4505.                                  - 69 -
  4506.  
  4507.  
  4508.  
  4509.            The reserve option makes sure no driver accesses  the  board's  I/O
  4510.       space  when probing for some device. You may also use the kernel parame-
  4511.       ters to override autoprobing for eth0:
  4512.  
  4513.  
  4514.            reserve=0x340,32 ether=0,0x340,eth0
  4515.  
  4516.  
  4517.  
  4518.  
  4519.            To turn off autoprobing altogether, you  can  specify  a  base addr
  4520.       argument of -1:
  4521.  
  4522.  
  4523.            ether=0,-1,eth0
  4524.  
  4525.  
  4526.  
  4527.  
  4528.  
  4529.  
  4530.  
  4531.       4.5  The PLIP Driver
  4532.  
  4533.  
  4534.  
  4535.  
  4536.            PLIP stands for Parallel Line IP and is a cheap way to network when
  4537.       you want to connect only two machines. It uses a  parallel  port  and  a
  4538.       special cable, achieving speeds of 10kBps to 20kBps.
  4539.  
  4540.  
  4541.            PLIP was originally developed by Crynwr, Inc.  Its design is rather
  4542.       ingenuous (or, if you prefer, hackish): for a long  time,  the  parallel
  4543.       ports on PCs used to be only uni-directional printer ports; that is, the
  4544.       eight data lines could only be used to send from the PC to  the  periph-
  4545.       eral  device,  but  not  the  other way round. PLIP works around this by
  4546.       using the port's five status line for input, which limits it  to  trans-
  4547.       ferring all data as nibbles (half bytes) only. This mode of operation is
  4548.       called mode zero PLIP.  Today, these uni-directional ports don't seem to
  4549.       be  used  much anymore. Therefore, there is also a PLIP extension called
  4550.       mode 1 that uses the full 8 bit interface.
  4551.  
  4552.  
  4553.            Currently, Linux only supports mode 0.  Unlike earlier versions  of
  4554.       the  PLIP code, it now attempts to be compatible with the PLIP implemen-
  4555.       tations  from  Crynwr,  as well as the PLIP driver in NCSA telnet.(5) To
  4556.       connect two machines using PLIP, you need a special cable sold  at  some
  4557.       shops  as ``Null Printer'' or ``Turbo Laplink'' cable. You can, however,
  4558.       make one yourself fairly easily. Appendix 20.3 shows you how.
  4559.  
  4560.  
  4561.       
  4562.  
  4563.       5. NCSA telnet is a popular program for DOS that runs TCP/IP
  4564.          over Ethernet or PLIP, and supports telnet and FTP.
  4565.  
  4566.  
  4567.  
  4568.  
  4569.  
  4570.  
  4571.  
  4572.                                  - 70 -
  4573.  
  4574.  
  4575.  
  4576.             The PLIP driver for Linux is the work of almost countless persons.
  4577.       It  is  currently maintained by Niibe Yutaka.  If compiled into the ker-
  4578.       nel, it sets up a network interface for each  of  the  possible  printer
  4579.       ports,  with plip0 corresponding to parallel port lp0, plip1 correspond-
  4580.       ing to lp1, etc.  The mapping of interface to ports is currently this:
  4581.  
  4582.  
  4583.       --------------------------------
  4584.       +-----------+-----------+------+
  4585.       |Interface  | I/O Port  | IRQ  |
  4586.       +-----------+-----------+------+
  4587.       |plip0      | 0x3BC     | 7    |
  4588.       |plip1      | 0x378     | 7    |
  4589.       |plip2      | 0x278     | 5    |
  4590.       +-----------+-----------+------+
  4591.       +-----------+-----------+------+
  4592.  
  4593.             If you have configured your printer port in a different  way,  you
  4594.       have  to  change these values in drivers/net/Space.c in the Linux kernel
  4595.       source, and build a new kernel.
  4596.  
  4597.  
  4598.            This mapping does not mean, however, that you cannot use these par-
  4599.       allel ports as usual. They are accessed by the PLIP driver only when the
  4600.       corresponding interface is configured up.
  4601.  
  4602.  
  4603.       4.6  The SLIP and PPP Drivers
  4604.  
  4605.  
  4606.  
  4607.  
  4608.            SLIP (Serial Line IP), and  PPP  (Point-to-Point  Protocol)  are  a
  4609.       widely used protocol for sending IP packets over a serial link. A number
  4610.       of institutions offer dialup SLIP and PPP access to machines that are on
  4611.       the  Internet,  thus providing IP connectivity to private persons (some-
  4612.       thing that's otherwise hardly affordable).
  4613.  
  4614.  
  4615.            To run SLIP or PPP, no hardware modifications  are  necessary;  you
  4616.       can use any serial port. Since serial port configuration is not specific
  4617.       to TCP/IP networking, a separate  chapter  has  been  devoted  to  this.
  4618.       Please refer to chapter 5. for more information.
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624.  
  4625.  
  4626.  
  4627.  
  4628.  
  4629.  
  4630.  
  4631.  
  4632.  
  4633.  
  4634.  
  4635.  
  4636.  
  4637.  
  4638.                                  - 71 -
  4639.  
  4640.  
  4641.  
  4642.       5.  Setting up the Serial Hardware
  4643.  
  4644.  
  4645.  
  4646.  
  4647.            There  are  rumors  that there are some people out there in netland
  4648.       who only own one PC and don't have the money to spend on a  T1  Internet
  4649.       link.   To  get their daily dose of news and mail nevertheless, they are
  4650.       said to rely on SLIP links, UUCP networks, and  bulletin  board  systems
  4651.       (BBS's) that utilize public telephone networks.
  4652.  
  4653.  
  4654.              This  chapter  is  intended  to help all those people who rely on
  4655.       modems to maintain their link. However, there are many details that this
  4656.       chapter  cannot  go  into,  for instance how to configure your modem for
  4657.       dialin. All these topics will be covered in the upcoming Serial HOWTO by
  4658.       Greg  Hankins,(1)  to  be  posted to comp.os.linux.announce on a regular
  4659.       basis.
  4660.  
  4661.  
  4662.       5.1  Communication Software for Modem Links
  4663.  
  4664.  
  4665.  
  4666.  
  4667.            There are a number of communication packages available  for  Linux.
  4668.       Many  of  them  are  terminal  programs  which allow a user to dial into
  4669.       another computer as if she was sitting in front of  a  simple  terminal.
  4670.       The  traditional  terminal program for Un*ces is kermit. It is, however,
  4671.       somewhat Spartan. There are more  comfortable  programs  available  that
  4672.       support  a  dictionary of telephone numers, script languages for calling
  4673.       and logging into remote computer systems, etc. One of them  is  minicom,
  4674.       which  is  close  to  some  terminal  programs former DOS users might be
  4675.       accustomed to. There are  also  X-based  communications  packages,  e.g.
  4676.       seyon.
  4677.  
  4678.  
  4679.            Also, a number of Linux-based BBS packages are available for people
  4680.       that want to run a bulletin board system.  Some of these packages can be
  4681.       found at sunsite.unc.edu in /pub/Linux/system/Network.
  4682.  
  4683.  
  4684.              Apart  from terminal programs, there is also software that uses a
  4685.       serial link non-interactively to transport data to  or  from  your  com-
  4686.       puter.  The  advantage of this technique is that it takes much less time
  4687.       to download a few dozen kilobytes automatically, than it might take  you
  4688.       to  read  your  mail on-line in some mailbox and browse a bulletin board
  4689.       for interesting articles. On the other hand,  this  requires  more  disk
  4690.       storage because of the loads of useless information you usually get.
  4691.  
  4692.  
  4693.            The  epitome of this sort of communications software is UUCP. It is
  4694.  
  4695.       
  4696.  
  4697.       1. To be reached at gregh@cc.gatech.edu.
  4698.  
  4699.  
  4700.  
  4701.  
  4702.  
  4703.  
  4704.  
  4705.                                  - 72 -
  4706.  
  4707.  
  4708.  
  4709.       a program suite that copies files from one  host  to  another,  executes
  4710.       programs  on a remote host, etc. It is frequently used to transport mail
  4711.       or news in private networks. Ian Taylor's UUCP package, which also  runs
  4712.       under  Linux,  is  described  in  the  following  chapter.   Other  non-
  4713.       interactive communication software  is,  for  example,  used  throughout
  4714.       Fidonet. Ports of Fidonet applications like ifmail are also available.
  4715.  
  4716.  
  4717.              SLIP,  the  serial line Internet protocol, is somewhat inbetween,
  4718.       allowing both interactive and non-interactive use. Many people use  SLIP
  4719.       to dial up their campus network or some other sort of public SLIP server
  4720.       to run FTP sessions, etc. SLIP may however also be used  over  permanent
  4721.       or  semi-permanent connections for LAN-to-LAN coupling, although this is
  4722.       really only interesting with ISDN.
  4723.  
  4724.  
  4725.       5.2  Introduction to Serial Devices
  4726.  
  4727.  
  4728.  
  4729.  
  4730.            The devices a Un*x kernel provides for accessing serial devices are
  4731.       typically  called  ttys. This is an abbreviation for Teletype(tm), which
  4732.       used to be one of the major manufacturers of terminals in the early days
  4733.       of  Unix.  The term is used nowadays for any character-based data termi-
  4734.       nal.  Throughout this chapter, we will use the term exclusively to refer
  4735.       to kernel devices.
  4736.  
  4737.  
  4738.            Linux  distinguishes  three  classes  of  ttys: (virtual) consoles,
  4739.       pseudo-terminals (similar to a two-way pipe, used by application such as
  4740.       X11),  and serial devices.  The latter are also counted as ttys, because
  4741.       they permit interactive sessions over a serial connection; be it from  a
  4742.       hard-wired terminal or a remote computer over a telephone line.
  4743.  
  4744.  
  4745.            Ttys  have  a  number  of  configurable parameters which can be set
  4746.       using the ioctl(2) system call.  Many  of  them  apply  only  to  serial
  4747.       devices, since they need a great deal more flexibility to handle varying
  4748.       types of connections.
  4749.  
  4750.  
  4751.             Among the most prominent line parameters are the  line  speed  and
  4752.       parity.   But  there are also flags for the conversion between upper and
  4753.       lower case characters, of carriage return into line feed, etc.  The  tty
  4754.       driver  may  also support various line disciplines which make the device
  4755.       driver behave completely different. For example,  the  SLIP  driver  for
  4756.       Linux is implemented by means of a special line discipline.
  4757.  
  4758.  
  4759.              There  is a bit of ambiguity about how to measure a line's speed.
  4760.       The correct the term is Bit rate, which is related to the line's  trans-
  4761.       fer  speed  measured  in bits per second (or bps for short).  Sometimes,
  4762.       you hear people refer to it  as  the  Baud  rate,  which  is  not  quite
  4763.  
  4764.  
  4765.  
  4766.  
  4767.  
  4768.  
  4769.  
  4770.  
  4771.                                  - 73 -
  4772.  
  4773.  
  4774.  
  4775.       correct.   These  two  terms are, however, not interchangeable. The Baud
  4776.       rate refers to a physical characteristic of some serial  device,  namely
  4777.       the  clock  rate  at  which pulses are transmitted.  The bit rate rather
  4778.       denotes a current state of an existing  serial  connection  between  two
  4779.       points,  namely the average number of bits transferred per second. It is
  4780.       important to know that these two values are usually different,  as  most
  4781.       devices encode more than one bit per electrical pulse.
  4782.  
  4783.  
  4784.       5.3  Accessing Serial Devices
  4785.  
  4786.       Like  all  devices  in  a Un*x system, serial ports are accessed through
  4787.       device special files, located in the  /dev  directory.   There  are  two
  4788.       varieties  of device files related to serial drivers, and for each port,
  4789.       there is one device file from each of them.  Depending on the file it is
  4790.       accessed by, the device will behave differently.
  4791.  
  4792.  
  4793.              The  first  variety is used whenever the port is used for dialing
  4794.       in; it has a major number of 4, and the files are  named  ttyS0,  ttyS1,
  4795.       etc.  The  second  variety  is used when dialing out through a port; the
  4796.       files are called cua0, etc, and have a major number of 5.
  4797.  
  4798.  
  4799.             Minor numbers are identical for both types. If you have your modem
  4800.       on  one of the ports COM1 through COM4, its minor number will be the COM
  4801.       port number plus 63. If your setup is different from that,  for  example
  4802.       when using a board supporting multiple serial lines, please refer to the
  4803.       Serial Howto.
  4804.  
  4805.  
  4806.            Assume your modem is on COM2. Thus its minor number will be 65, and
  4807.       its  major  number  will be 5 for dialing out.  There should be a device
  4808.       cua1 which has these numbers. List the serial ttys in  the  /dev  direc-
  4809.       tory.   Columns  5  and  6  should show major and minor numbers, respec-
  4810.       tively:
  4811.  
  4812.  
  4813.  
  4814.            $ ls -l /dev/cua*
  4815.            crw-rw-rw-   1 root     root       5,  64 Nov 30 19:31 /dev/cua0
  4816.            crw-rw-rw-   1 root     root       5,  65 Nov 30 22:08 /dev/cua1
  4817.            crw-rw-rw-   1 root     root       5,  66 Oct 28 11:56 /dev/cua2
  4818.            crw-rw-rw-   1 root     root       5,  67 Mar 19  1992 /dev/cua3
  4819.  
  4820.  
  4821.  
  4822.  
  4823.            If  there  is  no  such device, you will have to create one: become
  4824.       super-user and type
  4825.  
  4826.  
  4827.  
  4828.  
  4829.  
  4830.  
  4831.  
  4832.  
  4833.  
  4834.  
  4835.  
  4836.  
  4837.                                  - 74 -
  4838.  
  4839.  
  4840.  
  4841.            # mknod -m 666 /dev/cua1 c 5 65
  4842.            # chown root.root /dev/cua1
  4843.  
  4844.  
  4845.  
  4846.  
  4847.              Some  people  suggest  making  /dev/modem a symbolic link to your
  4848.       modem device, so that casual users don't have to remember  the  somewhat
  4849.       unintuitive  cua1. However, you cannot use modem in one program, and the
  4850.       real device file name in another. This is because these programs use so-
  4851.       called  lock files to signal that the device is used. By convention, the
  4852.       lock file name for cua1, for instance, is  LCK..cua1.   Using  different
  4853.       device  files  for the same port means that programs will fail to recog-
  4854.       nize each other's lock files, and will both use the device at  the  same
  4855.       time. As a result, both applications will not work at all.
  4856.  
  4857.  
  4858.  
  4859.  
  4860.  
  4861.       5.4  Serial Hardware
  4862.  
  4863.  
  4864.  
  4865.  
  4866.            Linux  currently supports a wide variety of serial boards which use
  4867.       the RS-232 standard.  RS-232 is currently the most common  standard  for
  4868.       serial communcications in the PC world. It uses a number of circuits for
  4869.       transmitting single bits as  well  as  for  synchronization.  Additional
  4870.       lines  may  be  used  for  signaling  the presence of a carrier (used by
  4871.       modems), and handshake.
  4872.  
  4873.  
  4874.             Although hardware handshake is optional, it  is  very  useful.  It
  4875.       allows  either  of  the  two  stations  to signal whether it is ready to
  4876.       receive more data, or if  the  other  station  should  pause  until  the
  4877.       receiver  is done processing the incoming data.  The lines used for this
  4878.       are called ``Clear to Send'' (CTS) and ``Ready to Send'' (RTS),  respec-
  4879.       tively,  which  accounts  for the colloquial name of hardware handshake,
  4880.       namely ``RTS/CTS''.
  4881.  
  4882.  
  4883.             In PCs, the RS-232 interface is usually  driven  by  a  UART  chip
  4884.       derived  from  the National Semiconductor 16450 chip, or a newer version
  4885.       thereof,  the  NSC 16550A(2) . Some brands (most notably internal modems
  4886.       equipped with the Rockwell chipset) also use completely different  chips
  4887.       that have been programmed to behave as if they were 16550's.
  4888.  
  4889.  
  4890.              The  main  difference between 16450's and 16550's that the latter
  4891.       have a FIFO buffer of 16 Bytes, while the  former  only  have  a  1-Byte
  4892.  
  4893.       
  4894.  
  4895.       2. There was also a NSC 16550, but it's  FIFO  never  really
  4896.          worked.
  4897.  
  4898.  
  4899.  
  4900.  
  4901.  
  4902.  
  4903.  
  4904.                                  - 75 -
  4905.  
  4906.  
  4907.  
  4908.       buffer.   This  makes 16450's suitable for speeds up to 9600 Baud, while
  4909.       higher speeds require a 16550-compatible  chip.   Besides  these  chips,
  4910.       Linux  also  supports the 8250 chip, which was the original UART for the
  4911.       PC-AT.
  4912.  
  4913.  
  4914.            In the default configuration, the kernel looks  for  four  standard
  4915.       serial  boards on COM1 through COM4. These will be assigned device minor
  4916.       numbers 64 through 67, as described above.
  4917.  
  4918.  
  4919.             If you want to configure your serial ports  properly,  you  should
  4920.       install  Ted  Tso's  setserial  command along with the rc.serial script.
  4921.       This script should be invoked from /etc/rc at system boot time. It  uses
  4922.       setserial  to  configure  the kernel serial devices. A typical rc.serial
  4923.       script looks like this:
  4924.  
  4925.  
  4926.  
  4927.            # /etc/rc.serial - serial line configuration script.
  4928.            #
  4929.            # Do wild interrupt detection
  4930.            /sbin/setserial -W /dev/cua*
  4931.  
  4932.            # Configure serial devices
  4933.            /sbin/setserial /dev/cua0 auto irq skip test autoconfig
  4934.            /sbin/setserial /dev/cua1 auto irq skip test autoconfig
  4935.            /sbin/setserial /dev/cua2 auto irq skip test autoconfig
  4936.            /sbin/setserial /dev/cua3 auto irq skip test autoconfig
  4937.  
  4938.            # Display serial device configuration
  4939.            /sbin/setserial -bg /dev/cua*
  4940.  
  4941.  
  4942.  
  4943.  
  4944.       Please refer to the documentation that comes along with setserial for an
  4945.       explanation of the parameters.
  4946.  
  4947.  
  4948.            If  your  serial card is not detected, or the setserial -bg command
  4949.       shows an incorrect setting, you will have to force the configuration  by
  4950.       explicitly  supplying  the  correct  values.  Users with internal modems
  4951.       equipped with the Rockwell chipset are reported to experience this prob-
  4952.       lem. If, for example, the UART chip is reported to be a NSC 16450, while
  4953.       in fact it is NSC 16550-compatible, you have to change the configuration
  4954.       command for the offending port to
  4955.  
  4956.  
  4957.            /sbin/setserial  /dev/cua1  auto irq skip test autoconfig
  4958.            uart 16550
  4959.  
  4960.  
  4961.  
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.  
  4968.  
  4969.  
  4970.                                  - 76 -
  4971.  
  4972.  
  4973.  
  4974.            Similar options exist to force COM port, base address, and IRQ set-
  4975.       ting. Please refer to the setserial(8) manual page.
  4976.  
  4977.  
  4978.             If your modem supports hardware handshake, you should make sure to
  4979.       enable  it.  Surprising  as  it  is,  most communication programs do not
  4980.       attempt to enable this by default; you have to set it manually  instead.
  4981.       This is best performed in the rc.serial script, using the stty command:
  4982.  
  4983.  
  4984.            $ stty crtscts < /dev/cua1
  4985.  
  4986.  
  4987.  
  4988.  
  4989.            To check if hardware handshake is in effect, use
  4990.  
  4991.  
  4992.            $ stty -a < /dev/cua1
  4993.  
  4994.  
  4995.  
  4996.  
  4997.            This  gives  you  the  status  of all flags for that device; a flag
  4998.       shown with a preceding minus as in -crtscts means that the flag has been
  4999.       turned off.
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.  
  5021.  
  5022.  
  5023.  
  5024.  
  5025.  
  5026.  
  5027.  
  5028.  
  5029.  
  5030.  
  5031.  
  5032.  
  5033.  
  5034.  
  5035.  
  5036.                                  - 77 -
  5037.  
  5038.  
  5039.  
  5040.       6.  Configuring TCP/IP Networking
  5041.  
  5042.       In  this  chapter, we will go through all the steps necessary to setting
  5043.       up TCP/IP networking on your machine. Starting with the assignment of IP
  5044.       addresses,  we  will  slowly  work  our way through the configuration of
  5045.       TCP/IP network interfaces, and introduce a few  tools  that  come  quite
  5046.       handy when hunting down problems with your network installation.
  5047.  
  5048.  
  5049.  
  5050.  
  5051.  
  5052.            Most  of  the tasks covered in this chapter you will generally have
  5053.       to do only once. Afterwards, you have to touch most configuration  files
  5054.       only  when  adding a new system to your network, or when you reconfigure
  5055.       your system entirely. Some of the commands  used  to  configure  TCP/IP,
  5056.       however,  have  to  be  executed each time the system is booted. This is
  5057.       usually done by invoking them from the system /etc/rc scripts.
  5058.  
  5059.  
  5060.            Commonly, the network-specific part of this procedure is  contained
  5061.       in  a  script called rc.net or rc.inet. Sometimes, you will also see two
  5062.       scripts named rc.inet1 and rc.inet2, where the  former  initializes  the
  5063.       kernel part of networking, while the latter starts basic networking ser-
  5064.       vices and applications. Throughout the following, I will adhere  to  the
  5065.       latter concept.
  5066.  
  5067.  
  5068.            Below,  I  will  discuss  the  actions performed by rc.inet1, while
  5069.       applications will be covered in later  chapters.  After  finishing  this
  5070.       chapter,  you  should have established a sequence of commands that prop-
  5071.       erly configure TCP/IP networking  on  your  computer.  You  should  then
  5072.       replace  any  sample  commands in rc.inet1 with your commands, make sure
  5073.       rc.inet1 is executed at startup time, and reboot your machine.  The net-
  5074.       working rc scripts that come along with your favorite Linux distribution
  5075.       should give you a good example.
  5076.  
  5077.  
  5078.       6.1  Setting up the proc Filesystem
  5079.  
  5080.  
  5081.  
  5082.  
  5083.            Some of the configuration tools of the Net-2 release  rely  on  the
  5084.       proc  filesystem for communicating with the kernel. This is an interface
  5085.       that permits access to kernel run-time information through a filesystem-
  5086.       like  mechanism.  When  mounted,  you  can list its files like any other
  5087.       filesystem, or display their contents.  Typical items include the  load-
  5088.       avg  file that contains the system load average, or meminfo, which shows
  5089.       current core memory and swap usage.
  5090.  
  5091.  
  5092.             To this, the networking code adds the net directory.  It  contains
  5093.       a number of files that show things like the kernel ARP tables, the state
  5094.  
  5095.  
  5096.  
  5097.  
  5098.  
  5099.  
  5100.  
  5101.  
  5102.                                  - 78 -
  5103.  
  5104.  
  5105.  
  5106.       of TCP connections, and the routing tables.  Most network administration
  5107.       tools get their information from these files.
  5108.  
  5109.  
  5110.              The  proc  filesystem  (or procfs as it is also known) is usually
  5111.       mounted on /proc at system boot time. The best method is to add the fol-
  5112.       lowing line to /etc/fstab:
  5113.  
  5114.  
  5115.  
  5116.            # procfs mont point:
  5117.            none            /proc           proc    defaults
  5118.  
  5119.  
  5120.  
  5121.  
  5122.       and execute ``mount /proc'' from your /etc/rc script.
  5123.  
  5124.  
  5125.            The procfs is nowadays configured into most kernels by default.  If
  5126.       the  procfs  is not in your kernel, you will get a message like ``mount:
  5127.       fs type procfs not supported by kernel''. You will then have  to  recom-
  5128.       pile the kernel and answer ``yes'' when asked for procfs support.
  5129.  
  5130.  
  5131.       6.2  Installing the Binaries
  5132.  
  5133.  
  5134.  
  5135.  
  5136.            If  you  are  using one of the pre-packaged Linux distributions, it
  5137.       will most probably contain the major networking applications and  utili-
  5138.       ties along with a coherent set of sample files.  The only case where you
  5139.       might have to obtain and install new utilities is when you install a new
  5140.       kernel  release. As they occasionally involve changes in the kernel net-
  5141.       working layer, you will need to update the  basic  configuration  tools.
  5142.       This  at  least  involves  recompiling,  but  sometimes  you may also be
  5143.       required to obtain the latest set of binaries.  These are  usually  dis-
  5144.       tributed  along  with  the  kernel,  packaged  in an archive called net-
  5145.       XXX.tar.gz, where XXX is the version number. The release matching  Linux
  5146.       1.0  is  0.32b,  the latest kernel as of this writing (1.1.12 and later)
  5147.       require 0.32d.
  5148.  
  5149.  
  5150.            If you want to compile and  install  the  standard  TCP/IP  network
  5151.       applications  yourself,  you  can obtain the sources from most Linux FTP
  5152.       servers.  These are more or less heavily patched  versions  of  programs
  5153.       from  Net-BSD  or  other  sources.  Other applications, such as Xmosaic,
  5154.       xarchie, or Gopher and IRC clients must be obtained separately.  Most of
  5155.       them compile out of the box if you follow the instructions.
  5156.  
  5157.  
  5158.              The official FTP site for Net-3 is sunacm.swan.ac.uk, mirrored by
  5159.       sunsite.unc.edu below system/Network/sunacm.  The  latest  Net-2e  patch
  5160.  
  5161.  
  5162.  
  5163.  
  5164.  
  5165.  
  5166.  
  5167.  
  5168.                                  - 79 -
  5169.  
  5170.  
  5171.  
  5172.       kit  and  binaries  are  available from ftp.aris.com.  Matthias Urlichs'
  5173.       BSD-derived  networking  code  can  be  gotten  from  ftp.ira.uka.de  in
  5174.       /pub/system/linux/netbsd.
  5175.  
  5176.  
  5177.       6.3  Another Example
  5178.  
  5179.  
  5180.  
  5181.  
  5182.            For the remainder of this book, let me introduce a new example that
  5183.       is less complex than Groucho Marx University, and may be closer  to  the
  5184.       tasks you will actually encounter. Consider the Virtual Brewery, a small
  5185.       company that brews, as the name indicates, virtual beer. To manage their
  5186.       business  more  efficiently,  the  virtual brewers want to network their
  5187.       computers, which all happen to be PCs running a bright and  shiny  Linux
  5188.       1.0.
  5189.  
  5190.  
  5191.            On  the  same floor, just across the hall, there's the Virtual Win-
  5192.       ery, who work closely with the brewery.  They run an Ethernet  of  their
  5193.       own.   Quite  naturally,  the  two companies want to link their networks
  5194.       once they are operational.  As a first step, they want to set up a gate-
  5195.       way  host  that  forwards datagrams between the two subnets. Later, they
  5196.       also want to have a UUCP link to the outside world, through  which  they
  5197.       exchange mail and news.  In the long run, the also want to set up a SLIP
  5198.       connection to connect to the Internet occasionally.
  5199.  
  5200.  
  5201.       6.4  Setting the Hostname
  5202.  
  5203.  
  5204.  
  5205.  
  5206.            Most, if not all, network applications rely  on  the  local  host's
  5207.       name having been set to some reasonable value. This is usually done dur-
  5208.       ing the boot procedure by executing the hostname  command.  To  set  the
  5209.       hostname to name, it is invoked as
  5210.  
  5211.  
  5212.            # hostname name
  5213.  
  5214.  
  5215.  
  5216.  
  5217.            It  is  common practice to use the unqualified hostname without any
  5218.       domain name for this. For instance, hosts at the Virtual  Brewery  might
  5219.       be  called vale.vbrew.com, vlager.vbrew.com, etc.  These are their offi-
  5220.       cial, fully qualified domain names.  Their local hostnames would be only
  5221.       the  first  component  of  the name, such as vale. However, as the local
  5222.       hostname is frequently used to look up the host's IP address,  you  have
  5223.       to  make sure that the resolver library is able to look up the host's IP
  5224.       address. This  usually  means  that  you  have  to  enter  the  name  in
  5225.       /etc/hosts (see below).
  5226.  
  5227.  
  5228.  
  5229.  
  5230.  
  5231.  
  5232.  
  5233.  
  5234.                                  - 80 -
  5235.  
  5236.  
  5237.  
  5238.              Some people suggest to use the domainname command to set the ker-
  5239.       nel's idea of a domain name to the remaining part of the FQDN.  In  this
  5240.       way you could combine the output from hostname and domainname to get the
  5241.       FQDN again.  However, this is at best only half correct.  domainname  is
  5242.       generally  used to set the host's NIS domain, which may be entirely dif-
  5243.       ferent from the DNS domain your host belongs  to.   NIS  is  covered  in
  5244.       chapter 11..
  5245.  
  5246.  
  5247.       6.5  Assigning IP Addresses
  5248.  
  5249.  
  5250.  
  5251.  
  5252.            If  you  configure  the  networking software on your host for stan-
  5253.       dalone operation (for instance, to be able to run the INN netnews  soft-
  5254.       ware),  you  can  safely  skip this section, because you will need an IP
  5255.       address just for the loopback interface, which is always 127.0.0.1.
  5256.  
  5257.  
  5258.            Things are a little more complicated with real networks like Ether-
  5259.       nets.  If you want to connect your host to an existing network, you have
  5260.       to ask its administrators to give you an IP  address  on  this  network.
  5261.       When  setting  up  the  network  all  by yourself, you have to assign IP
  5262.       addresses yourself as described below.
  5263.  
  5264.  
  5265.            Hosts within a local network should usually  share  addresses  from
  5266.       the  same  logical  IP  network.  Hence you have to assign an IP network
  5267.       address.  If you have several physical  networks,  you  either  have  to
  5268.       assign  them  different network numbers, or use subnetting to split your
  5269.       IP address range into several subnetworks.
  5270.  
  5271.  
  5272.            If your network is not connected to the Internet, you are  free  to
  5273.       choose any (legal) network address. You only have to make sure to choose
  5274.       one from classes A, B, or C, else things will most likely not work prop-
  5275.       erly.  However, if you intend to get on the Internet in the near future,
  5276.       you should obtain an official IP address now. The best way to proceed is
  5277.       to ask your network service provider to help you.  If you want to obtain
  5278.       a network number just in case you might get  on  the  Internet  someday,
  5279.       request a Network Address Application Form from hostmaster@internic.net.
  5280.  
  5281.  
  5282.             To operate several Ethernets (or other networks, once a driver  is
  5283.       available),  you have to split your network into subnets. Note that sub-
  5284.       netting is required only if you have more than  one  broadcast  network;
  5285.       point-to-point  links  don't count. For instance, if you have one Ether-
  5286.       net, and one or more SLIP links to the outside world, you don't need  to
  5287.       subnet  your  network.  The reason for this will be explained in chapter
  5288.       8..
  5289.  
  5290.  
  5291.            As an example, the brewery's network manager applies to the NIC for
  5292.  
  5293.  
  5294.  
  5295.  
  5296.  
  5297.  
  5298.  
  5299.  
  5300.                                  - 81 -
  5301.  
  5302.  
  5303.  
  5304.       a  class  B  network number, and is given 191.72.0.0.  To accomodate the
  5305.       two Ethernets, she decides to use eight bits of the host part  as  addi-
  5306.       tional  subnet  bits.  This leaves another eight bits for the host part,
  5307.       allowing for 254 hosts on each of the subnets. She then  assigns  subnet
  5308.       number 1 to the brewery, and gives the winery number 2. Their respective
  5309.       network addresses are thus 191.72.1.0 and 191.72.2.0. The subnet mask is
  5310.       255.255.255.0.
  5311.  
  5312.  
  5313.            vlager,  which is the gateway between the two networks, is assigned
  5314.       a host number of 1 on both of them, which  gives  it  the  IP  addresses
  5315.       191.72.1.1 and 191.72.2.1, respectively.  Figure  shows the two subnets,
  5316.       and the gateway.
  5317.  
  5318.  
  5319.            Note that in this example I am using a  class  B  network  to  keep
  5320.       things  simple; a class C network would be more realistic.  With the new
  5321.       networking code, subnetting is not limited to byte boundaries, so even a
  5322.       class  C  network  may  be split into several subnets. For instance, you
  5323.       could use 2 bits of the host part for the netmask, giving you four  pos-
  5324.       sible subnets with 64 hosts on each.(1)
  5325.  
  5326.  
  5327.       6.6  Writing hosts and networks Files
  5328.  
  5329.  
  5330.  
  5331.  
  5332.            After you have subnetted your network, you should prepare for  some
  5333.       simple sort of hostname resolution using the /etc/hosts file. If you are
  5334.       not going to use DNS or NIS for address resolution, you have to put  all
  5335.       hosts in the hosts file.
  5336.  
  5337.  
  5338.            Even  if  you  want  to run DNS or NIS during normal operation, you
  5339.       want to have some subset of all hostnames  in  /etc/hosts  nevertheless.
  5340.       For one, you want to have some sort of name resolution even when no net-
  5341.       work interfaces are running, for example during boot time.  This is  not
  5342.       only  a matter of convenience, but also allows you to use symbolic host-
  5343.       names in your rc.inet scripts. Thus, when  changing  IP  addresses,  you
  5344.       only  have  to  copy  an  updated hosts file to all machines and reboot,
  5345.       rather than having to edit a large number of rc files separately.   Usu-
  5346.       ally,  you  will  put all local hostnames and addresses in hosts, adding
  5347.       those of any gateways and NIS servers if used.(2)
  5348.  
  5349.  
  5350.            Also, during intial testing, you should  make  sure  your  resolver
  5351.       only  uses information from the hosts file. Your DNS or NIS software may
  5352.  
  5353.       
  5354.  
  5355.       1. The  last  number  on  each  subnet  is  reserved  as the
  5356.          broadcast address, so it's in fact 63 hosts per subnet.
  5357.       2. You will need the address of any NIS servers only if  you
  5358.          use  Peter  Eriksson's  NYS.  Other  NIS  implementations
  5359.          locate their servers at run-time only by using ypbind.
  5360.  
  5361.  
  5362.  
  5363.  
  5364.  
  5365.  
  5366.  
  5367.                                  - 82 -
  5368.  
  5369.  
  5370.  
  5371.       come with sample files that may produce strange results when being used.
  5372.       To  make all applications use /etc/hosts exclusively when looking up the
  5373.       IP address of a host, you have to edit the /etc/host.conf file.  Comment
  5374.       out any lines that begin with the keyword order by preceding them with a
  5375.       hash sign, and insert the line
  5376.  
  5377.  
  5378.            order hosts
  5379.  
  5380.  
  5381.  
  5382.  
  5383.            The configuration of the resolver library will be covered in detail
  5384.       in chapter 7..
  5385.  
  5386.  
  5387.            The  hosts  file  contains  one entry per line, consisting of an IP
  5388.       address, a hostname, and an optional list of aliases for  the  hostname.
  5389.       The  fields  are separated by spaces or tabs, and the address field must
  5390.       begin in column one. Anything following a hash sign (#) is regarded as a
  5391.       comment and is ignored.
  5392.  
  5393.  
  5394.            Hostnames  can  be either fully qualified, or relative to the local
  5395.       domain.  For vale, you would usually enter the the fully qualified name,
  5396.       vale.vbrew.com,  and  vale  by  itself  in the hosts file, so that it is
  5397.       known by both its official name and the shorter local name.
  5398.  
  5399.  
  5400.            This is an example how a hosts file at the  Virtual  Brewery  might
  5401.       look.   Two  special  names are included, vlager-if1 and vlager-if2 that
  5402.       give the addresses for both interfaces used on vlager.
  5403.  
  5404.  
  5405.  
  5406.            #
  5407.            # Hosts file for Virtual Brewery/Virtual Winery
  5408.            #
  5409.            # IP            local       fully qualified domain name
  5410.            #
  5411.            127.0.0.1       localhost
  5412.            #
  5413.            191.72.1.1      vlager      vlager.vbrew.com
  5414.            191.72.1.1      vlager-if1
  5415.            191.72.1.2      vstout      vstout.vbrew.com
  5416.            191.72.1.3      vale        vale.vbrew.com
  5417.            #
  5418.            191.72.2.1      vlager-if2
  5419.            191.72.2.2      vbeaujolais  vbeaujolais.vbrew.com
  5420.            191.72.2.3      vbardolino   vbardolino.vbrew.com
  5421.            191.72.2.4      vchianti     vchianti.vbrew.com
  5422.  
  5423.  
  5424.  
  5425.  
  5426.  
  5427.  
  5428.  
  5429.  
  5430.  
  5431.  
  5432.  
  5433.                                  - 83 -
  5434.  
  5435.  
  5436.  
  5437.            Just as with a host's IP address, you sometimes would like to use a
  5438.       symbolic  name for network numbers, too. Therefore, the hosts file has a
  5439.       companion called /etc/networks that maps network names to  network  num-
  5440.       bers and vice versa. At the Virtual Brewery, we might install a networks
  5441.       file like this:(3)
  5442.  
  5443.  
  5444.  
  5445.            # /etc/networks for the Virtual Brewery
  5446.            brew-net      191.72.1.0
  5447.            wine-net      191.72.2.0
  5448.  
  5449.  
  5450.  
  5451.  
  5452.       6.7  Interface Configuration for IP
  5453.  
  5454.  
  5455.  
  5456.  
  5457.             After setting up your hardware as explained in the previous  chap-
  5458.       ter, you have to make these devices known to the kernel networking soft-
  5459.       ware.  A couple of commands are used to  configure  the  network  inter-
  5460.       faces,  and  initialize  the routing table. These tasks are usually per-
  5461.       formed from the rc.inet1 script each time the  system  is  booted.   The
  5462.       basic tools for this are called ifconfig (where ``if'' stands for inter-
  5463.       face), and route.
  5464.  
  5465.  
  5466.            ifconfig is used to make an interface accessible to the kernel net-
  5467.       working  layer.  This involves the assignment of an IP address and other
  5468.       parameters, and activating the interface, also known as  ``taking  up.''
  5469.       Being  active  here means that the kernel will send and receive IP data-
  5470.       grams through the interface.  The simplest way to invoking it is
  5471.  
  5472.  
  5473.            ifconfig interface ip-address
  5474.  
  5475.  
  5476.  
  5477.  
  5478.       which assigns ip-address to  interface  and  activates  it.   All  other
  5479.       parameters  are  set to default values. For instance, the default subnet
  5480.       mask is derived from the network  class  of  the  IP  address,  such  as
  5481.       255.255.0.0  for  a class B address.  ifconfig is described in detail at
  5482.       the end of this chapter.
  5483.  
  5484.  
  5485.            route allows you to add or remove routes from  the  kernel  routing
  5486.       table. It can be invoked as
  5487.  
  5488.       
  5489.  
  5490.       3. Note  that  names  in  networks  must  not  collide  with
  5491.          hostnames  from  the  hosts  file, else some programs may
  5492.          produce strange results.
  5493.  
  5494.  
  5495.  
  5496.  
  5497.  
  5498.  
  5499.  
  5500.                                  - 84 -
  5501.  
  5502.  
  5503.  
  5504.            route [add|del] target
  5505.  
  5506.  
  5507.  
  5508.  
  5509.       where  the  add and del arguments determine whether to add or delete the
  5510.       route to target.
  5511.  
  5512.  
  5513.       6.7.1  The Loopback Interface
  5514.  
  5515.  
  5516.  
  5517.  
  5518.            The very first interface to be activated is the loopback interface:
  5519.  
  5520.  
  5521.            # ifconfig lo 127.0.0.1
  5522.  
  5523.  
  5524.  
  5525.  
  5526.             Occasionally, you will also see the dummy hostname localhost being
  5527.       used instead of the IP address. ifconfig will look up the  name  in  the
  5528.       hosts  file  where  an  entry  should  declare  it  as  the hostname for
  5529.       127.0.0.1:
  5530.  
  5531.  
  5532.  
  5533.            # Sample /etc/hosts entry for localhost
  5534.            localhost     127.0.0.1
  5535.  
  5536.  
  5537.  
  5538.  
  5539.              To  view  the  configuration of an interface, you invoke ifconfig
  5540.       giving it the interface name as argument:
  5541.  
  5542.  
  5543.  
  5544.            $ ifconfig lo
  5545.            lo        Link encap Local Loopback
  5546.                      inet addr 127.0.0.1  Bcast [NONE SET]  Mask 255.0.0.0
  5547.                      UP BROADCAST LOOPBACK RUNNING  MTU 2000  Metric 1
  5548.                      RX packets 0 errors 0 dropped 0 overrun 0
  5549.                      TX packets 0 errors 0 dropped 0 overrun 0
  5550.  
  5551.  
  5552.  
  5553.  
  5554.            As  you can see, the loopback interface has been assigned a netmask
  5555.       of 255.0.0.0, since 127.0.0.1 is a class A address.  As you can see, the
  5556.       interface  doesn't  have  a  broadcast address set, which isn't normally
  5557.       very useful for the loopback anyway.  However,  if  you  run  the  rwhod
  5558.  
  5559.  
  5560.  
  5561.  
  5562.  
  5563.  
  5564.  
  5565.  
  5566.                                  - 85 -
  5567.  
  5568.  
  5569.  
  5570.       daemon on your host, you may have to set the loopback device's broadcast
  5571.       address in order for rwho to function properly. Setting the broadcast is
  5572.       explained in section ``All about ifconfig'' below.
  5573.  
  5574.  
  5575.            Now,  you can almost start playing with your mini-``network.'' What
  5576.       is still missing is an entry in the routing table that tells IP that  it
  5577.       may  use  this  interface  as  route  to destination 127.0.0.1.  This is
  5578.       accomplished by typing
  5579.  
  5580.  
  5581.            # route add 127.0.0.1
  5582.  
  5583.  
  5584.  
  5585.  
  5586.            Again, you can use localhost instead of the IP address.
  5587.  
  5588.  
  5589.             Next, you should check that everything works fine, for example  by
  5590.       using  ping.  ping is the networking equivalent of a sonar device(4) and
  5591.       is used to verify that a given address is  actually  reachable,  and  to
  5592.       measure  the  delay  that  occurs when sending a datagram to it and back
  5593.       again.  The time required for this is often referred to  as  the  round-
  5594.       trip time.
  5595.  
  5596.  
  5597.  
  5598.            # ping localhost
  5599.            PING localhost (127.0.0.1): 56 data bytes
  5600.            64 bytes from 127.0.0.1: icmp seq=0 ttl=32 time=1 ms
  5601.            64 bytes from 127.0.0.1: icmp seq=1 ttl=32 time=0 ms
  5602.            64 bytes from 127.0.0.1: icmp seq=2 ttl=32 time=0 ms
  5603.            ^C
  5604.  
  5605.            --- localhost ping statistics ---
  5606.            3 packets transmitted, 3 packets received, 0% packet loss
  5607.            round-trip min/avg/max = 0/0/1 ms
  5608.  
  5609.  
  5610.  
  5611.  
  5612.            When  invoking  ping  as shown here, it will go on emitting packets
  5613.       forever unless interrupted by the user. The ^C  above  marks  the  place
  5614.       where we pressed Ctrl-C.
  5615.  
  5616.  
  5617.            The  above  example  shows  that packets for 127.0.0.1 are properly
  5618.       delivered and a reply is returned to ping almost instantaneously.   This
  5619.       shows you have succeeded in setting up your first network interface.
  5620.  
  5621.  
  5622.  
  5623.       
  5624.  
  5625.       4. Anyone remember Pink Floyd's ``Echoes''?
  5626.  
  5627.  
  5628.  
  5629.  
  5630.  
  5631.  
  5632.  
  5633.                                  - 86 -
  5634.  
  5635.  
  5636.  
  5637.              If  the  output  you  get  from ping does not resemble that shown
  5638.       above, you are in trouble. Check any error if they  indicate  some  file
  5639.       hasn't  been installed properly. Check that the ifconfig and route bina-
  5640.       ries you use are compatible with the kernel release you run, and,  above
  5641.       all,  that the kernel has been compiled with networking enabled (you see
  5642.       this from the presence of the /proc/net directory).  If you get an error
  5643.       message  saying  ``Network unreachable,'' then you probably have got the
  5644.       route command wrong. Make sure you use the same address as you  gave  to
  5645.       ifconfig.
  5646.  
  5647.  
  5648.              The  steps  described above are enough to use networking applica-
  5649.       tions on a standalone host. After adding the above lines to rc.inet1 and
  5650.       making  sure  both  rc.inet  scripts  are executed from /etc/rc, you may
  5651.       reboot your machine and try  out  various  applications.  For  instance,
  5652.       ``telnet  localhost'' should establish a telnet connection to your host,
  5653.       giving you a login prompt.
  5654.  
  5655.  
  5656.            However, the loopback interface is useful not only as an example in
  5657.       networking  books,  or  as a testbed during development, but is actually
  5658.       used by some applications during  normal  operation.(5)  Therefore,  you
  5659.       always  have  to  configure  it,  regardless  of whether your machine is
  5660.       attached to a network or not.
  5661.  
  5662.  
  5663.       6.7.2  Ethernet Interfaces
  5664.  
  5665.  
  5666.  
  5667.  
  5668.            Configuring an Ethernet interface goes pretty much the same as with
  5669.       the  loopback interface, it just requires a few more parameters when you
  5670.       are using subnetting.
  5671.  
  5672.  
  5673.            At the Virtual Brewery, we have subnetted the IP network, which was
  5674.       originally  a  class  B  network,  into class C subnetworks. To make the
  5675.       interface recognize this, the ifconfig incantation would look like this:
  5676.  
  5677.  
  5678.            # ifconfig eth0 vstout netmask 255.255.255.0
  5679.  
  5680.  
  5681.  
  5682.  
  5683.            This   assigns   the  eth0  interface  the  IP  address  of  vstout
  5684.       (191.72.1.2). If we had omitted the netmask, ifconfig would have deduced
  5685.       the  the netmask from the IP network class, which would have resulted in
  5686.       a netmask of 255.255.0.0.  Now a quick check shows:
  5687.  
  5688.       
  5689.  
  5690.       5. For instance, all  applications  based  on  RPC  use  the
  5691.          loopback   interface  to  register  themselves  with  the
  5692.          portmapper daemon at startup.
  5693.  
  5694.  
  5695.  
  5696.  
  5697.  
  5698.  
  5699.  
  5700.                                  - 87 -
  5701.  
  5702.  
  5703.  
  5704.            # ifconfig eth0
  5705.            eth0      Link encap 10Mps Ethernet HWaddr  00:00:C0:90:B3:42
  5706.                      inet addr 191.72.1.2 Bcast 191.72.1.255 Mask 255.255.255.0
  5707.                      UP BROADCAST RUNNING  MTU 1500  Metric 1
  5708.                      RX packets 0 errors 0 dropped 0 overrun 0
  5709.                      TX packets 0 errors 0 dropped 0 overrun 0
  5710.  
  5711.  
  5712.  
  5713.  
  5714.            You  can  see that ifconfig automatically set the broadcast address
  5715.       (the Bcast field above) to the usual value, which is the  hosts  network
  5716.       number  with the host bits all set. Also, the message transfer unit (the
  5717.       maximum size of Ethernet frames the kernel will generate for this inter-
  5718.       face)  has been set to the maximum value of 1500 bytes. All these values
  5719.       can be overidden with special options that will be described later.
  5720.  
  5721.  
  5722.            Quite similar to the loopback case, you now have to install a rout-
  5723.       ing  entry that informs the kernel about the network that can be reached
  5724.       through eth0.  For the Virtual Brewery, you would invoke route as
  5725.  
  5726.  
  5727.            # route add -net 191.72.1.0
  5728.  
  5729.  
  5730.  
  5731.  
  5732.            At first, this looks a little like magic, because it's  not  really
  5733.       clear  how route detects which interface to route through.  However, the
  5734.       trick is rather simple: the kernel checks all interfaces that have  been
  5735.       configured  so  far  and compares the destination address (191.72.1.0 in
  5736.       this case) to the network part of the interface address  (that  is,  the
  5737.       bitwise  and  of the interface address and the netmask). The only inter-
  5738.       face that matches is eth0.
  5739.  
  5740.  
  5741.            Now, what's that -net option for? This is used  because  route  can
  5742.       handle  both  routes to networks and routes to single hosts (as you have
  5743.       seen above with localhost). When being given an address in  dotted  quad
  5744.       notation,  it attempts to guess whether it is a network or a hostname by
  5745.       looking at the host part bits. If the address' host part is zero,  route
  5746.       assumes  it  denotes a network, otherwise it takes it as a host address.
  5747.       Therefore, route would think that 191.72.1.0 is a  host  address  rather
  5748.       than a network number, because it cannot know that we use subnetting. We
  5749.       therefore have to tell it explicitly that it denotes a  network,  giving
  5750.       it the -net flag.
  5751.  
  5752.  
  5753.            Of course, the above route command is a little tedious to type, and
  5754.       it's prone to spelling mistakes. A more convenient approach  is  to  use
  5755.       the  network  names  we have defined in /etc/networks above.  This makes
  5756.       the command much more readable; even the -net flag can now  be  omitted,
  5757.       because route now knows that 191.72.1.0 denotes a network.
  5758.  
  5759.  
  5760.  
  5761.  
  5762.  
  5763.  
  5764.  
  5765.  
  5766.                                  - 88 -
  5767.  
  5768.  
  5769.  
  5770.            # route add brew-net
  5771.  
  5772.  
  5773.  
  5774.  
  5775.             Now that you've finished the basic configuration steps, we want to
  5776.       make sure your Ethernet interface is indeed running  happily.  Choose  a
  5777.       host from your Ethernet, for instance vlager, and type
  5778.  
  5779.  
  5780.  
  5781.            # ping vlager
  5782.            PING vlager: 64 byte packets
  5783.            64 bytes from 191.72.1.1: icmp seq=0. time=11. ms
  5784.            64 bytes from 191.72.1.1: icmp seq=1. time=7. ms
  5785.            64 bytes from 191.72.1.1: icmp seq=2. time=12. ms
  5786.            64 bytes from 191.72.1.1: icmp seq=3. time=3. ms
  5787.            ^C
  5788.  
  5789.            ----vstout.vbrew.com PING Statistics----
  5790.            4 packets transmitted, 4 packets received, 0% packet loss
  5791.            round-trip (ms)  min/avg/max = 3/8/12
  5792.  
  5793.  
  5794.  
  5795.  
  5796.            If you don't see any output similar to this, then something is bro-
  5797.       ken,  obviously.  If you encounter unusual packet loss rates, this hints
  5798.       at a hardware problem, like bad or missing  terminators,  etc.   If  you
  5799.       don't receive any packets at all, you should check the interface config-
  5800.       uration with netstat. The packet statistics displayed by ifconfig should
  5801.       tell you whether any packets have been sent out on the interface at all.
  5802.       If you have access to the remote host, too, you should go over  to  that
  5803.       machine  and  check  the interface statistics, too. In this way, you can
  5804.       determine exactly where the  packets  got  dropped.   In  addition,  you
  5805.       should  display  the routing information with route to see if both hosts
  5806.       have the correct routing entry.  route prints out  the  complete  kernel
  5807.       routing  table  when  invoked  without any arguments (the -n option only
  5808.       makes it print addresses as dotted quad instead of using the hostname):
  5809.  
  5810.  
  5811.  
  5812.  
  5813.  
  5814.  
  5815.            # route -n
  5816.            Kernel routing table
  5817.            Destination     Gateway         Genmask         Flags Metric Ref Use    Iface
  5818.            127.0.0.1       *               255.255.255.255 UH    1      0      112 lo
  5819.            191.72.1.0      *               255.255.255.0   U     1      0       10 eth0
  5820.  
  5821.  
  5822.  
  5823.  
  5824.  
  5825.  
  5826.  
  5827.  
  5828.  
  5829.  
  5830.  
  5831.  
  5832.                                  - 89 -
  5833.  
  5834.  
  5835.  
  5836.            The  detailed meaning of these fields is explained below in section
  5837.       6.9. The Flag column contains a list of flags set for each interface.  U
  5838.       is  always set for active interfaces, and H says the destination address
  5839.       denotes a host.  If the H flag is set for a route that you meant to be a
  5840.       network  route,  then you have to specify the -net option with the route
  5841.       command. To check whether a route you have entered is used at all, check
  5842.       if  the  Use  field  in  the second to last column increases between two
  5843.       invocations of ping.
  5844.  
  5845.  
  5846.       6.7.3  Routing through a Gateway
  5847.  
  5848.  
  5849.  
  5850.  
  5851.            In the previous section, I covered only the case of  setting  up  a
  5852.       host  on  a  single  Ethernet. Quite frequently, however, one encounters
  5853.       networks connected to one another by gateways. These gateways may simply
  5854.       link two or more Ethernets, but may provide a link to the outside world,
  5855.       the Internet, as well. In order to use the service  of  a  gateway,  you
  5856.       have  to provide additional routing information to the networking layer.
  5857.  
  5858.  
  5859.            For instance, the Ethernets of the Virtual Brewery and the  Virtual
  5860.       Winery  are  linked  through  such  a  gateway,  namely the host vlager.
  5861.       Assuming that vlager has already been configured, we only  have  to  add
  5862.       another  entry  to  vstout's  routing table that tells the kernel it can
  5863.       reach all hosts on the Winery's network through vlager.  The appropriate
  5864.       incantation  of  route  is shown below; the gw keyword tells it that the
  5865.       next argument denotes a gateway.
  5866.  
  5867.  
  5868.            # route add wine-net gw vlager
  5869.  
  5870.  
  5871.  
  5872.  
  5873.            Of course, any host on the Winery network you wish to talk to  must
  5874.       have  a corresponding routing entry for the Brewery's network, otherwise
  5875.       you would only be able to send data from vstout to vbardolino,  but  any
  5876.       response returned by the latter would go into the great bit bucket.
  5877.  
  5878.  
  5879.            This example describes only a gateway that switches packets between
  5880.       two isolated Ethernets. Now assume that vlager also has a connection  to
  5881.       the  Internet (say, through an additional SLIP link). Then we would want
  5882.       datagrams to any destination network other than the Brewery to be handed
  5883.       to vlager. This can be accomplished by making it the default gateway for
  5884.       vstout:
  5885.  
  5886.  
  5887.            # route add default gw vlager
  5888.  
  5889.  
  5890.  
  5891.  
  5892.  
  5893.  
  5894.  
  5895.  
  5896.  
  5897.  
  5898.                                  - 90 -
  5899.  
  5900.  
  5901.  
  5902.             The network name default is a shorthand for 0.0.0.0, which denotes
  5903.       the  default  route.  You do not have to add this name to /etc/networks,
  5904.       because it is built into route.
  5905.  
  5906.  
  5907.            When you see high packet loss rates when pinging a host behind  one
  5908.       or  more  gateways,  this  may hint at a very congested network.  Packet
  5909.       loss is not so much due to technical deficiencies as  due  to  temporary
  5910.       excess  loads  on  forwarding hosts, which makes them delay or even drop
  5911.       incoming datagrams.
  5912.  
  5913.  
  5914.       6.7.4  Configuring a Gateway
  5915.  
  5916.  
  5917.  
  5918.  
  5919.            Configuring a machine to switch packets between  two  Ethernets  is
  5920.       pretty  straightforward.  Assume we're back at vlager, which is equipped
  5921.       with two Ethernet boards, each being connected to one of  the  two  net-
  5922.       works.  All you have to do is configure both interfaces separately, giv-
  5923.       ing them their respective IP address, and that's it.
  5924.  
  5925.  
  5926.            It is quite useful to add information on the two interfaces to  the
  5927.       hosts file in the way shown below, so we have handy names for them, too:
  5928.  
  5929.  
  5930.  
  5931.            191.72.1.1      vlager      vlager.vbrew.com
  5932.            191.72.1.1      vlager-if1
  5933.            191.72.2.1      vlager-if2
  5934.  
  5935.  
  5936.  
  5937.  
  5938.            The sequence of commands to set up the two interfaces is then:
  5939.  
  5940.  
  5941.  
  5942.            # ifconfig eth0 vlager-if1
  5943.            # ifconfig eth1 vlager-if2
  5944.            # route add brew-net
  5945.            # route add wine-net
  5946.  
  5947.  
  5948.  
  5949.  
  5950.       6.7.5  The PLIP Interface
  5951.  
  5952.  
  5953.  
  5954.  
  5955.            When using a PLIP link to connect two machines, things are a little
  5956.  
  5957.  
  5958.  
  5959.  
  5960.  
  5961.  
  5962.  
  5963.  
  5964.                                  - 91 -
  5965.  
  5966.  
  5967.  
  5968.       different  from  what you have to do when using an Ethernet.  The former
  5969.       are so-called point-to-point links, because they involve ony  two  hosts
  5970.       (``points''), as opposed to broadcast networks.
  5971.  
  5972.  
  5973.            As  an example, we consider the laptop computer of some employee at
  5974.       the Virtual Brewery that is connected to vlager via  PLIP.   The  laptop
  5975.       itself  is  called  vlite, and has only one parallel port. At boot time,
  5976.       this port will be registered as plip1. To activate the link, you have to
  5977.       configure the plip1 interface using the following commands:(6)
  5978.  
  5979.  
  5980.  
  5981.            # ifconfig plip1 vlite pointopoint vlager
  5982.            # route add default gw vlager
  5983.  
  5984.  
  5985.  
  5986.  
  5987.            The first command configures the interface, telling the kernel that
  5988.       this is a point-to-point link, with the remote side having  the  address
  5989.       of  vlager. The second installs the default route, using vlager as gate-
  5990.       way.  On vlager, a similar ifconfig command is necessary to activate the
  5991.       link (a route invocation is not needed):
  5992.  
  5993.  
  5994.  
  5995.            # ifconfig plip1 vlager pointopoint vlite
  5996.  
  5997.  
  5998.  
  5999.  
  6000.            The  interesting  point  is that the plip1 interface on vlager does
  6001.       not have to have a separate IP  address,  but  may  also  be  given  the
  6002.       address 191.72.1.1.(7)
  6003.  
  6004.  
  6005.            Now,  we  have  configured routing from the laptop to the Brewery's
  6006.       network; what's still missing is a way to route from any  of  the  Brew-
  6007.       ery's  hosts  to vlite. One particularly cumbersome way is to add a spe-
  6008.       cific route to every host's routing table that names vlager as a gateway
  6009.       to vlite:
  6010.  
  6011.  
  6012.  
  6013.  
  6014.  
  6015.       
  6016.  
  6017.       6. Note  that  pointopoint  is not a typo. It's really spelt
  6018.          like this.
  6019.       7. Just as a matter of caution, you should however configure
  6020.          a PLIP or SLIP link only after you have completely set up
  6021.          the  routing  table entries for your Ethernets. With some
  6022.          older kernels, your network route might otherwise end  up
  6023.          pointing at the point-to-point link.
  6024.  
  6025.  
  6026.  
  6027.  
  6028.  
  6029.  
  6030.  
  6031.                                  - 92 -
  6032.  
  6033.  
  6034.  
  6035.            # route add vlite gw vlager
  6036.  
  6037.  
  6038.  
  6039.  
  6040.              A  much  better option when faced with temporary routes is to use
  6041.       dynamic routing.  One way to do so is to use gated,  a  routing  daemon,
  6042.       which  you would have to install on each host in the network in order to
  6043.       distribute routing information dynamically.  The easiest  way,  however,
  6044.       is  to  use  proxy  ARP.  With proxy ARP, vlager will respond to any ARP
  6045.       query for vlite by sending its own Ethernet address. The effect of  this
  6046.       is  that  all  packets for vlite will wind up at vlager, which then for-
  6047.       wards them to the laptop. We will come back to proxy ARP in section 6.10
  6048.       below.
  6049.  
  6050.  
  6051.            Future  Net-3  releases will contain a tool called plipconfig which
  6052.       will allow you to set the IRQ of the printer port to  use.  Later,  this
  6053.       may even be replaced by a more general ifconfig command.
  6054.  
  6055.  
  6056.       6.7.6  The SLIP and PPP Interface
  6057.  
  6058.  
  6059.  
  6060.  
  6061.            Although  SLIP  and  PPP links are only simple point-to-point links
  6062.       like PLIP connections, there is much more to be said about  them.   Usu-
  6063.       ally,  establishing  a SLIP connection involves dialing up a remote site
  6064.       through your modem, and setting the serial line to  SLIP  mode.  PPP  is
  6065.       used  in  a similar fashion. The tools required for setting up a SLIP or
  6066.       PPP link will be described in chapters 8. and 9..
  6067.  
  6068.  
  6069.       6.7.7  The Dummy Interface
  6070.  
  6071.  
  6072.  
  6073.  
  6074.            The dummy interface is really a little exotic,  but  rather  useful
  6075.       nevertheless.  Its  main  benefit is with standalone hosts, and machines
  6076.       whose only IP network connection is a dial-up link. In fact, the  latter
  6077.       are standalone hosts most of the time, too.
  6078.  
  6079.  
  6080.            The  dilemma  with standalone hosts is that they only have a single
  6081.       network device active, the loopback device, which  is  usually  assigned
  6082.       the  address  127.0.0.1.   On  some occasions, however, you need to send
  6083.       data to the `official' IP address of the local host. For instance,  con-
  6084.       sider  the laptop vlite, that has been disconnected from any network for
  6085.       the duration of this example.  An application on vlite may now  want  to
  6086.       send some data to another application on the same host. Looking up vlite
  6087.       in /etc/hosts yields an IP address of 191.72.1.65,  so  the  application
  6088.       tries  to  send  to this address. As the loopback interface is currently
  6089.  
  6090.  
  6091.  
  6092.  
  6093.  
  6094.  
  6095.  
  6096.  
  6097.                                  - 93 -
  6098.  
  6099.  
  6100.  
  6101.       the only active interface on the machine, the kernel has  no  idea  that
  6102.       this  address  actually  refers  to itself! As a consequence, the kernel
  6103.       discards the datagram, and returns an error to the application.
  6104.  
  6105.  
  6106.            This is where the dummy device steps in. It solves the  dilemma  by
  6107.       simply  serving as the alter ego of the loopback interface.  In the case
  6108.       of vlite, you would simply give it the address  191.72.1.65  and  add  a
  6109.       host  route pointing to it. Every datagram for 191.72.1.65 would then be
  6110.       delivered locally. The proper invocation is:
  6111.  
  6112.  
  6113.  
  6114.            # ifconfig dummy vlite
  6115.            # route add vlite
  6116.  
  6117.  
  6118.  
  6119.  
  6120.       6.8  All About ifconfig
  6121.  
  6122.  
  6123.  
  6124.  
  6125.            There are a lot more parameters to ifconfig than we have  described
  6126.       above. Its normal invocation is this:
  6127.  
  6128.  
  6129.            ifconfig interface [[-net|-host] address [parameters]]
  6130.  
  6131.  
  6132.  
  6133.  
  6134.            interface is the interface name, and address is the IP  address  to
  6135.       be  assigned to the interface.  This may either be an IP address in dot-
  6136.       ted quad notation, or a name ifconfig will look  up  in  /etc/hosts  and
  6137.       /etc/networks.   The  -net and -host options force ifconfig to treat the
  6138.       address as network number or host address, respectively.
  6139.  
  6140.  
  6141.             If ifconfig is invoked with only the interface name,  it  displays
  6142.       that  interface's configuration. When invoked without any parameters, it
  6143.       displays all interfaces you configured so far; an option of -a forces it
  6144.       to show the inactive ones as well.  A sample invocation for the Ethernet
  6145.       interface eth0 may look like this:
  6146.  
  6147.  
  6148.  
  6149.  
  6150.  
  6151.  
  6152.  
  6153.  
  6154.  
  6155.  
  6156.  
  6157.  
  6158.  
  6159.  
  6160.  
  6161.  
  6162.  
  6163.                                  - 94 -
  6164.  
  6165.  
  6166.  
  6167.            # ifconfig eth0
  6168.            eth0      Link encap 10Mbps Ethernet  HWaddr 00:00:C0:90:B3:42
  6169.                      inet addr 191.72.1.2 Bcast 191.72.1.255 Mask 255.255.255.0
  6170.                      UP BROADCAST RUNNING  MTU 1500  Metric 0
  6171.                      RX packets 3136 errors 217 dropped 7 overrun 26
  6172.                      TX packets 1752 errors 25 dropped 0 overrun 0
  6173.  
  6174.  
  6175.  
  6176.  
  6177.  
  6178.             The MTU and Metric fields show the current MTU  and  metric  value
  6179.       for that interface. The metric value is traditionally used by some oper-
  6180.       ating systems to compute the cost of a route.  Linux  doesn't  use  this
  6181.       value yet, but defines it for compatibility nevertheless.
  6182.  
  6183.  
  6184.            The  RX  and  TX  lines show how many packets have been received or
  6185.       transmitted error free, how many errors occurred, how many packets  were
  6186.       dropped,  probably because of low memory, and how many were lost because
  6187.       of an overrun. Receiver overruns usually happen  when  packets  come  in
  6188.       faster  than the kernel can service the last interrupt.  The flag values
  6189.       printed by ifconfig correspond more or less to the names of its  command
  6190.       line options; they will be explained below.
  6191.  
  6192.  
  6193.            The  following  is a list of parameters recognized by ifconfig with
  6194.       the corresponding flag names are given in brackets. Options that  simply
  6195.       turn  on a feature also allow it to be turned off again by preceding the
  6196.       option name by a dash (-).
  6197.  
  6198.  
  6199.  
  6200.  
  6201.              up This marks an interface ``up'',  i.e.  accessible  to  the  IP
  6202.                 layer.  This option is implied when an address is given on the
  6203.                 command line. It may also be used to re-eenable  an  interface
  6204.                 that has been taken down temporarily using the down option.
  6205.  
  6206.  
  6207.       (This option corresponds to the flags UP RUNNING.)
  6208.  
  6209.  
  6210.            down This  marks an interface ``down'', i.e. inaccessible to the IP
  6211.                 layer. This effectively disables any IP  traffic  through  the
  6212.                 interface.  Note that this does not delete all routing entries
  6213.                 that use this interface automatically.  If you take the inter-
  6214.                 face  down  permanently,  you  should  to delete these routing
  6215.                 entries and supply alternative routes if possible.
  6216.  
  6217.  
  6218.       netmask mask  This assigns a subnet mask to be used  by  the  interface.
  6219.                 It may be given as either a 32-bit hexadecimal number preceded
  6220.                 by 0x, or as a dotted quad of decimal numbers.
  6221.  
  6222.  
  6223.  
  6224.  
  6225.  
  6226.  
  6227.  
  6228.  
  6229.                                  - 95 -
  6230.  
  6231.  
  6232.  
  6233.       pointopoint address  This option is used  for  point-to-point  IP  links
  6234.                 that  involve only two hosts. This option is needed to config-
  6235.                 ure, for example, SLIP or PLIP interfaces.
  6236.  
  6237.  
  6238.       (If a point-to-point address has been set, ifconfig displays the POINTO-
  6239.                 POINT flag.)
  6240.  
  6241.  
  6242.       broadcast address   The  broadcast  address  is usually made up from the
  6243.                 network number by setting all bits of the host part.  Some  IP
  6244.                 implementations  use  a different scheme; this option is there
  6245.                 to adapt to these strange environments.
  6246.  
  6247.  
  6248.       (If a broadcast address has been set, ifconfig  displays  the  BROADCAST
  6249.                 flag.)
  6250.  
  6251.  
  6252.       metric number   This  option may be used to assign a metric value to the
  6253.                 routing table entry created for the interface. This metric  is
  6254.                 used  by the Routing Information Protocol (RIP) to build rout-
  6255.                 ing  tables  for  the  network.(8)  The default metric used by
  6256.                 ifconfig is a value of zero. If you don't run  a  RIP  daemon,
  6257.                 you  don't need this option at all; if you do, you will rarely
  6258.                 need to change the metric value.
  6259.  
  6260.  
  6261.       mtu bytes  This sets the Maximum Transmission Unit, which is the maximum
  6262.                 number of octets the interface is able to handle in one trans-
  6263.                 action. For Ethernets, the MTU  defaults  to  1500;  for  SLIP
  6264.                 interfaces, this is 296.
  6265.  
  6266.  
  6267.             arp  This is an option specific to broadcast networks such as Eth-
  6268.                 ernets or packet radio. It enables the use of ARP, the Address
  6269.                 Resolution Protocol, to detect the physical addresses of hosts
  6270.                 attached to the network. For  broadcast  networks,  is  on  by
  6271.                 default.
  6272.  
  6273.  
  6274.       (If ARP is disabled, ifconfig displays the flag NOARP.)
  6275.  
  6276.  
  6277.  
  6278.  
  6279.       
  6280.  
  6281.       8. RIP chooses the optimal route to a given  host  based  on
  6282.          the  ``length'' of the path. It is computed by summing up
  6283.          the individual metric values of each  host-to-host  link.
  6284.          By  default,  a  hop  has  length  1, but this may be any
  6285.          positive integer less than 16. (A route length of  16  is
  6286.          equal  to infinity. Such routes are considered unusable.)
  6287.          The metric parameter sets this hop cost,  which  is  then
  6288.          broadcast by the routing daemon.
  6289.  
  6290.  
  6291.  
  6292.  
  6293.  
  6294.  
  6295.  
  6296.                                  - 96 -
  6297.  
  6298.  
  6299.  
  6300.            -arp Disables the use of ARP on this interface.
  6301.  
  6302.  
  6303.         promisc   Puts  the interface in promiscuous mode. On a broadcast net-
  6304.                 work, this makes the interface receive all packets, regardless
  6305.                 of  whether  they  were destined for another host or not. This
  6306.                 allows an analysis of network traffic using packet filters and
  6307.                 such,  also called Ethernet snooping.  Usually, this is a good
  6308.                 technique of hunting down network problems that are  otherwise
  6309.                 hard to come by.
  6310.  
  6311.  
  6312.                      On  the  other  hand,  this  allows attackers to skim the
  6313.                 traffic of your network  for  passwords  and  do  other  nasty
  6314.                 things.  One  protection against this type of attack is not to
  6315.                 let anyone just plug in  their  computers  in  your  Ethernet.
  6316.                 Another option is to use secure authentication protocols, such
  6317.                 as Kerberos, or the SRA login suite.(9)
  6318.  
  6319.  
  6320.       (This option corresponds to the flag PROMISC.)
  6321.  
  6322.  
  6323.        -promisc Turns off promiscuous mode.
  6324.  
  6325.  
  6326.        allmulti  Multicast addresses are some sort of broadcast to a group  of
  6327.                 hosts  who  don't  necessarily  have to be on the same subnet.
  6328.                 Multicast addresses are not yet supported by the kernel.
  6329.  
  6330.  
  6331.       (This option corresponds to the flag ALLMULTI.)
  6332.  
  6333.  
  6334.       -allmulti Turns off multicast addresses.
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340.       6.9  Checking with netstat
  6341.  
  6342.  
  6343.  
  6344.  
  6345.            Next, I will turn to a useful tool for checking your  network  con-
  6346.       figuration  and activity. It is called netstat and is, in fact, rather a
  6347.       collection of several tools lumped together. We will discuss each of its
  6348.       functions in the following sections.
  6349.  
  6350.  
  6351.  
  6352.  
  6353.       
  6354.  
  6355.       9. SRA can be obtained from ftp.tamu.edu in /pub/sec/TAMU.
  6356.  
  6357.  
  6358.  
  6359.  
  6360.  
  6361.  
  6362.  
  6363.                                  - 97 -
  6364.  
  6365.  
  6366.  
  6367.       6.9.1  Displaying the Routing Table
  6368.  
  6369.  
  6370.  
  6371.  
  6372.            When  invoking  netstat  with  the  -r flag, it displays the kernel
  6373.       routing table in the way we've been doing this  with  route  above.   On
  6374.       vstout, it produces:
  6375.  
  6376.  
  6377.  
  6378.            # netstat -nr
  6379.            Kernel routing table
  6380.            Destination     Gateway         Genmask         Flags Metric Ref Use    Iface
  6381.            127.0.0.1       *               255.255.255.255 UH    1      0       50 lo
  6382.            191.72.1.0      *               255.255.255.0   U     1      0      478 eth0
  6383.            191.72.2.0      191.72.1.1      255.255.255.0   UGN   1      0      250 eth0
  6384.  
  6385.  
  6386.  
  6387.  
  6388.            The  -n option makes netstat print addresses as dotted quad IP num-
  6389.       bers rather than the symbolic host and network names. This is especially
  6390.       useful  when you want to avoid address lookups over the network (e.g. to
  6391.       a DNS or NIS server).
  6392.  
  6393.  
  6394.            The second column of netstat's output shows the gateway the routing
  6395.       entry  points to. If no gateway is used, an asterisk is printed instead.
  6396.       Column three shows the ``generality'' of the route.  When  given  an  IP
  6397.       address  to find a suitable route for, the kernel goes through all rout-
  6398.       ing table entries, taking the bitwise AND of the address and the genmask
  6399.       before comparing it to the target of the route.
  6400.  
  6401.  
  6402.            The fourth column displays various flags that describe the route:
  6403.  
  6404.  
  6405.  
  6406.  
  6407.               G The route uses a gateway.
  6408.  
  6409.  
  6410.               U The interface to be used is up.
  6411.  
  6412.  
  6413.               H Only a single host can be reached through the route. For exam-
  6414.                 ple, this is the case for the loopback entry 127.0.0.1.
  6415.  
  6416.  
  6417.               D This is set if the table entry has been generated by  an  ICMP
  6418.                 redirect message (see section 3.5).
  6419.  
  6420.  
  6421.  
  6422.  
  6423.  
  6424.  
  6425.  
  6426.  
  6427.  
  6428.  
  6429.                                  - 98 -
  6430.  
  6431.  
  6432.  
  6433.               M This  is  set if the table entry was modified by an ICMP redi-
  6434.                 rect message.
  6435.  
  6436.  
  6437.  
  6438.            The Ref column of netstat's output shows the number  of  references
  6439.       to  this  route,  that is, how many other routes (e.g. through gateways)
  6440.       rely on the presence of this route. The last two columns show the number
  6441.       of  times  the routing entry has been used, and the interface that data-
  6442.       grams are passed to for delivery.
  6443.  
  6444.  
  6445.       6.9.2  Displaying Interface Statistics
  6446.  
  6447.  
  6448.  
  6449.  
  6450.            When invoked with the -i flag, netstat will display statistics  for
  6451.       the  network  interfaces  currently  configured. If, in addition, the -a
  6452.       option is given, it will print all interfaces present in the kernel, not
  6453.       only  those  that have been configured currently. On vstaout, the output
  6454.       from netstat will look like this:
  6455.  
  6456.  
  6457.  
  6458.            $ netstat -i
  6459.            Kernel Interface table
  6460.            Iface   MTU Met  RX-OK RX-ERR RX-DRP RX-OVR  TX-OK TX-ERR TX-DRP TX-OVR Flags
  6461.            lo        0   0   3185      0      0      0   3185      0      0      0 BLRU
  6462.            eth0   1500   0 972633     17     20    120 628711    217      0      0 BRU
  6463.  
  6464.  
  6465.  
  6466.  
  6467.            The  MTU  and  Met fields show the current MTU and metric value for
  6468.       that interface. The RX and TX columns show how many  packets  have  been
  6469.       received  or  transmitted  error free (RX-OK/TX-OK), damaged (RX-ERR/TX-
  6470.       ERR), how many were dropped (RX-DRP/TX-DRP),  and  how  many  were  lost
  6471.       because of an overrun (RX-OVR/TX-OVR).
  6472.  
  6473.  
  6474.            The  last column shows the flags that have been set for this inter-
  6475.       face.  These are one-character versions of the long flag names  the  are
  6476.       printed when you display the interface configuration with ifconfig.
  6477.  
  6478.  
  6479.  
  6480.  
  6481.               B A broadcast address has been set.
  6482.  
  6483.               L This interface is a loopback device
  6484.  
  6485.               M All packets are received (promiscuous mode).
  6486.  
  6487.  
  6488.  
  6489.  
  6490.  
  6491.  
  6492.  
  6493.  
  6494.  
  6495.                                  - 99 -
  6496.  
  6497.  
  6498.  
  6499.               N Trailers are avoided.
  6500.  
  6501.               O ARP is turned off for this interface.
  6502.  
  6503.               P This is a point-to-point connection.
  6504.  
  6505.               R Interface is running.
  6506.  
  6507.               U Interface is up.
  6508.  
  6509.  
  6510.  
  6511.       6.9.3  Displaying Connections
  6512.  
  6513.  
  6514.  
  6515.  
  6516.            netstat  supports  a  set  of  options to display active or passive
  6517.       sockets. The options -t, -u, -w, and -x show active TCP,  UDP,  RAW,  or
  6518.       UNIX  socket connections.  If you provide the -a flag in addition, sock-
  6519.       ets that are waiting for a connection (i.e. listening) are displayed  as
  6520.       well.   This will give you a list of all servers that are currently run-
  6521.       ning on your system.
  6522.  
  6523.  
  6524.            Invoking netstat -ta on vlager produces
  6525.  
  6526.  
  6527.  
  6528.            $ netstat -ta
  6529.            Active Internet connections
  6530.            Proto Recv-Q Send-Q Local Address    Foreign Address    (State)
  6531.            tcp        0      0 *:domain         *:*                LISTEN
  6532.            tcp        0      0 *:time           *:*                LISTEN
  6533.            tcp        0      0 *:smtp           *:*                LISTEN
  6534.            tcp        0      0 vlager:smtp      vstout:1040        ESTABLISHED
  6535.            tcp        0      0 *:telnet         *:*                LISTEN
  6536.            tcp        0      0 localhost:1046   vbardolino:telnet  ESTABLISHED
  6537.            tcp        0      0 *:chargen        *:*                LISTEN
  6538.            tcp        0      0 *:daytime        *:*                LISTEN
  6539.            tcp        0      0 *:discard        *:*                LISTEN
  6540.            tcp        0      0 *:echo           *:*                LISTEN
  6541.            tcp        0      0 *:shell          *:*                LISTEN
  6542.            tcp        0      0 *:login          *:*                LISTEN
  6543.  
  6544.  
  6545.  
  6546.  
  6547.            This  shows most servers simply waiting for an incoming connection.
  6548.       However, the fourth line shows an incoming SMTP connection from  vstout,
  6549.       and  the  sixth line tells you there is an outgoing telnet connection to
  6550.       vbardolino.(10)
  6551.  
  6552.  
  6553.       
  6554.  
  6555.  
  6556.  
  6557.  
  6558.  
  6559.  
  6560.  
  6561.  
  6562.                                  - 100 -
  6563.  
  6564.  
  6565.  
  6566.            Using  the  -a flag all by itself will display all sockets from all
  6567.       families.
  6568.  
  6569.  
  6570.  
  6571.  
  6572.  
  6573.       6.10  Checking the ARP Tables
  6574.  
  6575.  
  6576.  
  6577.  
  6578.            On some occasions, it is useful to view or even alter the  contents
  6579.       of  the  kernel's  ARP  tables, for example when you suspect a duplicate
  6580.       Internet address is the cause for  some  intermittent  network  problem.
  6581.       The  arp  tool was made for things like these.  Its command line options
  6582.       are
  6583.  
  6584.  
  6585.            arp [-v] [-t hwtype] -a [hostname]
  6586.            arp [-v] [-t hwtype] -s hostname hwaddr
  6587.            arp [-v] -d hostname [hostname...]
  6588.  
  6589.  
  6590.  
  6591.  
  6592.            All hostname arguments may be either  symbolic  host  names  or  IP
  6593.       addresses in dotted quad notation.
  6594.  
  6595.  
  6596.            The  first  invocation displays the ARP entry for the IP address or
  6597.       host specified, or all hosts known if no hostname is given.   For  exam-
  6598.       ple, invoking arp on vlager may yield
  6599.  
  6600.  
  6601.  
  6602.            # arp -a
  6603.            IP address      HW type                 HW address
  6604.            191.72.1.3      10Mbps Ethernet         00:00:C0:5A:42:C1
  6605.            191.72.1.2      10Mbps Ethernet         00:00:C0:90:B3:42
  6606.            191.72.2.4      10Mbps Ethernet         00:00:C0:04:69:AA
  6607.  
  6608.  
  6609.  
  6610.  
  6611.       which shows the Ethernet addresses of vlager, vstout and vale.
  6612.  
  6613.  
  6614.       
  6615.  
  6616.       10.You can tell whether a connection is outgoing or not from
  6617.          the  port numbers involved. The port number shown for the
  6618.          calling host will always be a simple  integer,  while  on
  6619.          the  host being called, a well-known service port will be
  6620.          in use, for which netstat uses the symbolic name found in
  6621.          /etc/services.
  6622.  
  6623.  
  6624.  
  6625.  
  6626.  
  6627.  
  6628.  
  6629.                                  - 101 -
  6630.  
  6631.  
  6632.  
  6633.            Using  the -t option you can limit the display to the hardware type
  6634.       specified.  This may be ether, ax25, or pronet, standing for 10Mbps Eth-
  6635.       ernet, AMPR AX.25, and IEEE 802.5 token ring equipment, respectively.
  6636.  
  6637.  
  6638.            The  -s  option  is  used  to  permanently  add hostname's Ethernet
  6639.       address to the ARP tables. The hwaddr argument  specifies  the  hardware
  6640.       address,  which is by default expected to be an Ethernet address, speci-
  6641.       fied as six hexadecimal bytes separated by colons.  You may also set the
  6642.       hardware  address for other types of hardware, too, using the -t option.
  6643.  
  6644.  
  6645.            One problem which may require you to manually add an IP address  to
  6646.       the  ARP  table is when for some reasons ARP queries for the remote host
  6647.       fail, for instance when its ARP driver is buggy or there is another host
  6648.       in  the  network  that erroneously identifies itself with that host's IP
  6649.       address.  Hard-wiring IP addresses in the ARP  table  is  also  a  (very
  6650.       drastic)  measure  to  protect yourself from hosts on your Ethernet that
  6651.       pose as someone else.
  6652.  
  6653.  
  6654.            Invoking arp using the -d switch deletes all ARP  entries  relating
  6655.       to  the  given  host.   This  may  be used to force the interface to re-
  6656.       attempt to obtain the Ethernet address for the IP address  in  question.
  6657.       This  is  useful  when  a  misconfigured  system has broadcast wrong ARP
  6658.       information (of course, you have to reconfigure the broken host before).
  6659.  
  6660.  
  6661.              The -s option may also be used to implement proxy ARP.  This is a
  6662.       special technique where a host, say gate, acts as a gateway  to  another
  6663.       host  named  fnord,  by pretending that both addresses refer to the same
  6664.       host, namely gate. It does so by publishing an ARP entry for fnord  that
  6665.       points  to  its own Ethernet interface. Now when a host sends out an ARP
  6666.       query for fnord, gate will return a reply containing  its  own  Ethernet
  6667.       address.  The  querying host will then send all datagrams to gate, which
  6668.       dutyfully forwards them to fnord.
  6669.  
  6670.  
  6671.            These contortions may be necessary, for instance, when you want  to
  6672.       access  fnord  from  a DOS machine with a broken TCP implementation that
  6673.       doesn't understand routing too well. When you use  proxy  ARP,  it  will
  6674.       appear  to  the  DOS  machine as if fnord was on the local subnet, so it
  6675.       doesn't have to know about how to route through a gateway.
  6676.  
  6677.  
  6678.            Another very useful application of proxy ARP is when  one  of  your
  6679.       hosts  acts  as  a  gateway  to  some  other  host only temporarily, for
  6680.       instance through a dial-up link.  In  a  previous  example,  we  already
  6681.       encountered  the  laptop  vlite  which was connected to vlager through a
  6682.       PLIP link only from time to time.  Of course, this will work only if the
  6683.       address  of the host you want to provide proxy ARP for is on the same IP
  6684.       subnet as your gateway. For instance, vstout could  proxy  ARP  for  any
  6685.       host  on  the  Brewery  subnet (191.72.1.0), but never for a host on the
  6686.       Winery subnet (191.72.2.0).
  6687.  
  6688.  
  6689.  
  6690.  
  6691.  
  6692.  
  6693.  
  6694.  
  6695.                                  - 102 -
  6696.  
  6697.  
  6698.  
  6699.            The proper invocation to provide  proxy  ARP  for  fnord  is  given
  6700.       below; of course, the Ethernet address given must be that of gate.
  6701.  
  6702.  
  6703.  
  6704.            # arp -s fnord 00:00:c0:a1:42:e0 pub
  6705.  
  6706.  
  6707.  
  6708.  
  6709.            The proxy ARP entry may be removed again by invoking:
  6710.  
  6711.  
  6712.  
  6713.            # arp -d fnord
  6714.  
  6715.  
  6716.  
  6717.  
  6718.       6.11  The Future
  6719.  
  6720.       Linux  networking  is still evolving.  Major changes at the kernel layer
  6721.       will bring a very flexible configuration scheme that will allow  you  to
  6722.       configure  the  network devices at run time.  For instance, the ifconfig
  6723.       command will take arguments that set the IRQ line and DMA channel.
  6724.  
  6725.  
  6726.             Another change to come soon is the  additional  mtu  flag  to  the
  6727.       route command which will set the Maximum Transmission Unit for a partic-
  6728.       ular route.  This route-specific MTU overrides the MTU specified for the
  6729.       interface.   You  will  typically  use  this option for routes through a
  6730.       gateway, where the link between the gateway  and  the  destination  host
  6731.       requires a very low MTU. For instance, assume host wanderer is connected
  6732.       to vlager through a SLIP link.  When sending data from  vstout  to  wan-
  6733.       derer, the networking layer on wanderer would would use packets of up to
  6734.       1500 bytes, because packets are sent across the Ethernet. The SLIP link,
  6735.       on  the other hand, is operated with an MTU of 296, so the network layer
  6736.       on vlager would have to break up the IP packets into  smaller  fragments
  6737.       that fit into 296 bytes. If instead, you would have configured the route
  6738.       on vstout to use a MTU of 296 right  from  the  start,  this  relatively
  6739.       expensive fragmentation could be avoided:
  6740.  
  6741.  
  6742.  
  6743.            # route add wanderer gw vlager mtu 296
  6744.  
  6745.  
  6746.  
  6747.  
  6748.              Note  that the mtu option also allows you to selectively undo the
  6749.       effects of the `Subnets Are Local' Policy (SNARL). This policy is a ker-
  6750.       nel configuration option and is described in chapter 4..
  6751.  
  6752.  
  6753.  
  6754.  
  6755.  
  6756.  
  6757.  
  6758.  
  6759.  
  6760.  
  6761.                                  - 103 -
  6762.  
  6763.  
  6764.  
  6765.       7.  Name Service and Resolver Configuraton
  6766.  
  6767.  
  6768.  
  6769.  
  6770.            As discussed in chapter 3., TCP/IP networking may rely on different
  6771.       schemes to convert names into addresses.  The simplest way, which  takes
  6772.       no advantage of the way the name space has been split up into zones is a
  6773.       host table stored in /etc/hosts.  This is useful  only  for  small  LANs
  6774.       that are run by one single administrator, and otherwise have no IP traf-
  6775.       fic with the outside world.  The format of the hosts  file  has  already
  6776.       been described in chapter 6..
  6777.  
  6778.  
  6779.              Alternatively,  you  may  use  BIND -- the Berkeley Internet Name
  6780.       Domain Service --  for resolving host names to IP addresses.   Configur-
  6781.       ing  BIND  may  be a real chore, but once you've done it, changes in the
  6782.       network topology are easily made. On Linux, as  on  many  other  Un*xish
  6783.       systems,  name  service  is provided through a program called named.  At
  6784.       startup, it loads a set of  master files into its cache, and  waits  for
  6785.       queries from remote or local user processes. There are different ways to
  6786.       set up BIND, and not all require you to run a name server on every host.
  6787.  
  6788.  
  6789.            This  chapter  can do little more but give a rough sketch of how to
  6790.       operate a name server. If you plan to use BIND  in  an  enviroment  with
  6791.       more  than  just a small LAN and probably an Internet uplink, you should
  6792.       get a good book on BIND, for instance Cricket  Liu's  ``DNS  and  BIND''
  6793.       (see [ GETST "liu-dns" ]). For current information, you may also want to
  6794.       check the release notes contained in the BIND sources.  There's  also  a
  6795.       newsgroup for DNS questions called comp.protocols.tcp-ip.domains.
  6796.  
  6797.  
  6798.       7.1  The Resolver Library
  6799.  
  6800.  
  6801.  
  6802.  
  6803.            When talking of ``the resolver'', we do not mean any special appli-
  6804.       cation, but rather refer to the resolver library, a collection of  func-
  6805.       tions  that can be found in the standard C library. The central routines
  6806.       are gethostbyname(2) and gethostbyaddr(2) which look up all IP addresses
  6807.       belonging  to  a host, and vice versa.  They may be configured to simply
  6808.       look up the information in hosts, query a number of name servers, or use
  6809.       the hosts database of NIS (Network Information Service).  Other applica-
  6810.       tions, like smail, may include different drivers for any of  these,  and
  6811.       need special care.
  6812.  
  6813.  
  6814.       7.1.1  The host.conf File
  6815.  
  6816.  
  6817.  
  6818.  
  6819.  
  6820.  
  6821.  
  6822.  
  6823.  
  6824.  
  6825.  
  6826.  
  6827.                                  - 104 -
  6828.  
  6829.  
  6830.  
  6831.            The  central  file  that controls your resolver setup is host.conf.
  6832.       It resides in /etc and tells the resolver which services to use, and  in
  6833.       what order.
  6834.  
  6835.  
  6836.            Options  in  host.conf  must occur on separate lines. Fields may be
  6837.       separated by white space (spaces or tabs). A hash sign (#) introduces  a
  6838.       comment that extends to the next newline.
  6839.  
  6840.  
  6841.            The following options are available:
  6842.  
  6843.  
  6844.           order  This determines the order in which the resolving services are
  6845.                 tried. Valid options are bind for querying  the  name  server,
  6846.                 hosts for lookups in /etc/hosts, and nis for NIS lookups.  Any
  6847.                 or all of them may be  specified.  The  order  in  which  they
  6848.                 appear on the line detemines the order in which the respective
  6849.                 services are tried.
  6850.  
  6851.  
  6852.           multi Takes on or off as  options.  This  detemines  if  a  host  in
  6853.                 /etc/hosts  is  allowed to have several IP addresses, which is
  6854.                 usually referred to as being ``multi-homed''. This flag has no
  6855.                 effect on DNS or NIS queries.
  6856.  
  6857.  
  6858.         nospoof   As explained in the previous chapter, DNS allows you to find
  6859.                 the hostname belonging to an  IP  address  by  using  the  in-
  6860.                 addr.arpa  domain.  Attempts by name servers to supply a false
  6861.                 hostname are called ``spoofing''. To guard against  this,  the
  6862.                 resolver may be configured to check if the original IP address
  6863.                 is in fact associated with the hostname obtained. If not,  the
  6864.                 name  is  rejected  and  an  error  returned. This behavior is
  6865.                 turned on by setting nospoof on.
  6866.  
  6867.  
  6868.           alert This option takes on or off as arguments.  If it is turned on,
  6869.                 any  spoof attempts (see above) will cause the resolver to log
  6870.                 a message to the syslog facility.
  6871.  
  6872.  
  6873.            trim This option takes a domain name as an argument, which will  be
  6874.                 removed from hostnames before lookup. This is useful for hosts
  6875.                 entries, where you might only want to specify hostnames  with-
  6876.                 out  local  domain.   A lookup of a host with the local domain
  6877.                 name appended will have this removed, thus allowing the lookup
  6878.                 in /etc/hosts to succeed.
  6879.  
  6880.  
  6881.                      trim  options  accumulate, making it possible to consider
  6882.                 your host as being local to several domains.
  6883.  
  6884.  
  6885.  
  6886.  
  6887.  
  6888.  
  6889.  
  6890.  
  6891.  
  6892.  
  6893.                                  - 105 -
  6894.  
  6895.  
  6896.  
  6897.            A sample file for vlager is shown below:
  6898.  
  6899.  
  6900.  
  6901.            # /etc/host.conf
  6902.            # We have named running, but no NIS (yet)
  6903.            order   bind hosts
  6904.            # Allow multiple addrs
  6905.            multi   on
  6906.            # Guard against spoof attempts
  6907.            nospoof on
  6908.            # Trim local domain (not really necessary).
  6909.            trim    vbrew.com.
  6910.  
  6911.  
  6912.  
  6913.  
  6914.       7.1.2  Resolver Environment Variables
  6915.  
  6916.  
  6917.  
  6918.  
  6919.            The settings from host.conf may be overridden  using  a  number  of
  6920.       environment variables. These are
  6921.  
  6922.  
  6923.  
  6924.  
  6925.       RESOLV HOST CONF This   specifies   a   file   to  be  read  instead  of
  6926.                 /etc/host.conf.
  6927.  
  6928.  
  6929.       RESOLV SERV ORDER Overrides the order option given in  host.conf.   Ser-
  6930.                 vices are given as hosts, bind, and nis, separated by a space,
  6931.                 comma, colon, or semicolon.
  6932.  
  6933.  
  6934.       RESOLV SPOOF CHECK Determines the measures taken against spoofing. It is
  6935.                 completely  disabled  by  off.   The  values warn and warn off
  6936.                 enable spoof checking, but turn logging on  and  off,  respec-
  6937.                 tively.  A  value  of  * turns on spoof checks, but leaves the
  6938.                 logging facility as defined in host.conf.
  6939.  
  6940.  
  6941.       RESOLV MULTI A value of on or off may be  used  to  override  the  multi
  6942.                 options from tt host.conf.
  6943.  
  6944.  
  6945.       RESOLV OVERRIDE TRIM DOMAINS This  environment  specifies a list of trim
  6946.                 domains which override those given in host.conf.
  6947.  
  6948.  
  6949.       RESOLV ADD TRIM DOMAINS This  environment  specifies  a  list  of   trim
  6950.                 domains which are added to those given in host.conf.
  6951.  
  6952.  
  6953.  
  6954.  
  6955.  
  6956.  
  6957.  
  6958.  
  6959.                                  - 106 -
  6960.  
  6961.  
  6962.  
  6963.       7.1.3  Configuring Name Server Lookups --- resolv.conf
  6964.  
  6965.  
  6966.  
  6967.  
  6968.            When  configuring the resolver library to use the BIND name service
  6969.       for host lookups, you also have to tell it which name  servers  to  use.
  6970.       There  is  a  separate  file for this, called resolv.conf.  If this file
  6971.       does not exist or is empty, the resolver assumes the name server  is  on
  6972.       your local host.
  6973.  
  6974.  
  6975.            If  you run a name server on your local host, you have to set it up
  6976.       separately, as will be explained in the following section.  If your  are
  6977.       on  a  local  network  and have the opportunity to use an existing name-
  6978.       server, this should always be preferred.
  6979.  
  6980.  
  6981.            The most important option in resolv.conf is nameserver, which gives
  6982.       the  IP  address  of  a name server to use. If you specifiy several name
  6983.       servers by giving the nameserver option several times, they are tried in
  6984.       the  order  given.  You  should  therefore  put the most reliable server
  6985.       first.  Currently, up to three name servers are supported.
  6986.  
  6987.  
  6988.            If no nameserver option is given, the resolver attempts to  connect
  6989.       to the name server on the local host.
  6990.  
  6991.  
  6992.              Two  other  options,  domain and search deal with default domains
  6993.       that are tacked onto a hostname if BIND fails to  resolve  it  with  the
  6994.       first  query.  The  search option specifies a list of domain names to be
  6995.       tried. The list items are separated by spaces or tabs.
  6996.  
  6997.  
  6998.            If no search option is given, a default search list is  constructed
  6999.       from  the  local  domain  name by using the domain name itself, plus all
  7000.       parent domains up to the root. The local domain name may be given  using
  7001.       the  domain statement; if none is given, the resolver obtains it through
  7002.       the getdomainname(2) system call.
  7003.  
  7004.  
  7005.       If this sounds confusing to you, consider this sample  resolv.conf  file
  7006.       for the Virtual Brewery:
  7007.  
  7008.  
  7009.  
  7010.            # /etc/resolv.conf
  7011.            # Our domain
  7012.            domain         vbrew.com
  7013.            #
  7014.            # We use vlager as central nameserver:
  7015.            nameserver     191.72.1.1
  7016.  
  7017.  
  7018.  
  7019.  
  7020.  
  7021.  
  7022.  
  7023.  
  7024.  
  7025.                                  - 107 -
  7026.  
  7027.  
  7028.  
  7029.            When  resolving the name vale, the resolver would look up vale, and
  7030.       failing this, vale.vbrew.com, and vale.com.
  7031.  
  7032.  
  7033.       7.1.4  Resolver Robustness
  7034.  
  7035.  
  7036.  
  7037.  
  7038.            If you are running a LAN inside a larger  network,  you  definitely
  7039.       should  use central name servers if they are available. The advantage of
  7040.       this is that these will develop rich caches, since all queries are  for-
  7041.       warded  to  them.  This  scheme,  however  has  a  drawback: when a fire
  7042.       recently destroyed the backbone cable at our university,  no  more  work
  7043.       was  possible  on  our  department's  LAN, because the resolver couldn't
  7044.       reach any of the name servers anymore. There was no logging in on X ter-
  7045.       minals anymore, no printing, etc.
  7046.  
  7047.  
  7048.            Although  it  is not very common for campus backbones to go down in
  7049.       flames, one might want to take precautions against cases like these.
  7050.  
  7051.  
  7052.            One option is to set up a local name server that resolves hostnames
  7053.       from  your local domain, and forwards all queries for other hostnames to
  7054.       the main servers. Of course, this is applicable only if you are  running
  7055.       your own domain.
  7056.  
  7057.  
  7058.            Alternatively, you can maintain a backup host table for your domain
  7059.       or LAN in /etc/hosts. In /etc/host.conf you would then  include  ``order
  7060.       bind  hosts''  to  make  the resolver fall back to the hosts file if the
  7061.       central name server is down.
  7062.  
  7063.  
  7064.  
  7065.  
  7066.  
  7067.       7.2  Running named
  7068.  
  7069.  
  7070.  
  7071.  
  7072.            The program that provides domain name service on most Un*x machines
  7073.       is  usually called named (pronounced name-dee). This is a server program
  7074.       originally developed for BSD providing name service to clients, and pos-
  7075.       sibly  to  other  name servers. The version currently used on most Linux
  7076.       installations seems to be BIND-4.8.3. The new  version,  BIND-4.9.3,  is
  7077.       being  Beta-tested at the moment, and should be available on Linux soon.
  7078.  
  7079.  
  7080.            This section requires some understanding of the way the Domain Name
  7081.       System  works.  If the following discussion is all Greek to you, you may
  7082.       want to re-read chapter 3., which  has  some  more  information  on  the
  7083.  
  7084.  
  7085.  
  7086.  
  7087.  
  7088.  
  7089.  
  7090.  
  7091.                                  - 108 -
  7092.  
  7093.  
  7094.  
  7095.       basics of DNS.
  7096.  
  7097.  
  7098.              named  is usually started at system boot time, and runs until the
  7099.       machine goes down again.  It takes its information from a  configuration
  7100.       file called /etc/named.boot, and various files that contain data mapping
  7101.       domain names to addresses and the  like.  The  latter  are  called  zone
  7102.       files.   The  formats  and semantics of these files will be explained in
  7103.       the following section.
  7104.  
  7105.  
  7106.            To run named, simply enter
  7107.  
  7108.  
  7109.            # /usr/sbin/named
  7110.  
  7111.  
  7112.  
  7113.  
  7114.       at the prompt. named will come up, read the named.boot file and any zone
  7115.       files  specified therein. It writes its process id to /var/run/named.pid
  7116.       in ASCII, downloads any zone files from primary servers,  if  necessary,
  7117.       and starts listening on port 53 for DNS queries.(1)
  7118.  
  7119.  
  7120.       7.2.1  The named.boot File
  7121.  
  7122.       The named.boot file is generally very small and contains little else but
  7123.       pointers  to  master  files containing zone information, and pointers to
  7124.       other name servers.  Comments in the boot file start  with  a  semicolon
  7125.       and  extend  to  the  next  newline.   Before  we  discuss the format of
  7126.       named.boot in more detail, we will take a look at the  sample  file  for
  7127.       vlager given in figure 7.2.1.(2)
  7128.  
  7129.  
  7130.  
  7131.  
  7132.  
  7133.            The  cache and primary commands shown in this example load informa-
  7134.       tion into named. This information is taken from the master files  speci-
  7135.       fied in the second argument. They contain textual representations of DNS
  7136.       resource records, which we will look at below.
  7137.  
  7138.  
  7139.  
  7140.       
  7141.  
  7142.       1. There  are  various  named binaries floating around Linux
  7143.          FTP sites, each configured  a  little  differently.  Some
  7144.          have  their  pid  file  in /etc, some store it in /tmp or
  7145.          /var/tmp.
  7146.       2. Note  that  the  domain  names  in this example are given
  7147.          without trailing dot. Earlier versions of named  seem  to
  7148.          treat  trailing  dots  in  named.boot  as  an  error, and
  7149.          silently discards the line. BIND-4.9.3  is  said  to  fix
  7150.          this.
  7151.  
  7152.  
  7153.  
  7154.  
  7155.  
  7156.  
  7157.  
  7158.                                  - 109 -
  7159.  
  7160.  
  7161.  
  7162.  
  7163.  
  7164.  
  7165.  
  7166.                 ;
  7167.                 ; /etc/named.boot file for vlager.vbrew.com
  7168.                 ;
  7169.                 directory     /var/named
  7170.                 ;
  7171.                 ;             domain                   file
  7172.                 ;---------------------------------------------------
  7173.                 cache         .                        named.ca
  7174.                 primary       vbrew.com                named.hosts
  7175.                 primary       0.0.127.in-addr.arpa     named.local
  7176.                 primary       72.191.in-addr.arpa      named.rev
  7177.  
  7178.  
  7179.  
  7180.  
  7181.  
  7182.                Figure 9.   The named.boot file for vlager.
  7183.  
  7184.            In this example, we configured named as the primary name server for
  7185.       three  domains, as indicated by the primary statements at the end of the
  7186.       file. The first of these lines, for instance, instructs named to act  as
  7187.       a  primary  server  for  vbrew.com,  taking  the zone data from the file
  7188.       named.hosts. The directory keyword tells it  that  all  zone  files  are
  7189.       located in /var/named.
  7190.  
  7191.  
  7192.            The  cache entry is very special and should be present on virtually
  7193.       all machines running  a  name  server.  Its  function  is  two-fold:  it
  7194.       instructs  named  to  enable its cache, and to load the root name server
  7195.       hints from the cache file specified (named.ca in our example).  We  will
  7196.       come back to the name server hints below.
  7197.  
  7198.  
  7199.            Here's  a  list  of  the  most  important  options  you  can use in
  7200.       named.boot:
  7201.  
  7202.  
  7203.  
  7204.  
  7205.       directory This specifies a directory in which zone files reside.   Names
  7206.                 of  files  may  be  given relative to this directory.  Several
  7207.                 directories may be specified by  repeatedly  using  directory.
  7208.                 According  to  the  Linux  filesystem standard, this should be
  7209.                 /var/named.
  7210.  
  7211.  
  7212.         primary  This takes a domain name and a  file  name  as  an  argument,
  7213.                 declaring the local server authoritative for the named domain.
  7214.                 As a primary server, named loads the zone information from the
  7215.                 given master file.
  7216.  
  7217.  
  7218.  
  7219.  
  7220.  
  7221.  
  7222.  
  7223.  
  7224.                                  - 110 -
  7225.  
  7226.  
  7227.  
  7228.                      Generally,  there  will  always  be  at least one primary
  7229.                 entry in every boot file, namely for reverse mapping  of  net-
  7230.                 work 127.0.0.0, which is the local loopback network.
  7231.  
  7232.  
  7233.       secondary   This  statement  takes a domain name, an address list, and a
  7234.                 file name as an argument. It declares the local server a  sec-
  7235.                 ondary master server for the domain specified.
  7236.  
  7237.  
  7238.                      A  secondary  server  holds  authoritative  data  on  the
  7239.                 domain, too, but it doesn't gather it from files, but tries to
  7240.                 download  it  from  the  primary  server. The IP address of at
  7241.                 least one primary server must thus be given to  named  in  the
  7242.                 address  list.  The  local server will contact each of them in
  7243.                 turn until it successfully transfers the zone database,  which
  7244.                 is then stored in the backup file given as the third argument.
  7245.                 If none of the primary servers  responds,  the  zone  data  is
  7246.                 retrieved from the backup file instead.
  7247.  
  7248.  
  7249.                      named will then attempt to refresh the zone data at regu-
  7250.                 lar intervals. This is explained  below  along  in  connection
  7251.                 with the SOA resource record type.
  7252.  
  7253.  
  7254.           cache   This takes a domain and a file name as arguments.  This file
  7255.                 contains the root server hints, that  is  a  list  of  records
  7256.                 pointing  to the root name servers. Only NS and A records will
  7257.                 be recognized. The  domain  argument  is  generally  the  root
  7258.                 domain name ``.''.
  7259.  
  7260.  
  7261.                      This  information  is absolutely crucial to named: if the
  7262.                 cache statement does not occur in the boot  file,  named  will
  7263.                 not  develop  a local cache at all. This will severely degrade
  7264.                 performance and increase  network  load  if  the  next  server
  7265.                 queried  is  not on the local net. Moreover, named will not be
  7266.                 able to reach any root name servers, and thus it won't resolve
  7267.                 any  addresses except those it is authoritative for. An excep-
  7268.                 tion from this rule is when using forwarding servers (cf.  the
  7269.                 forwarders option below).
  7270.  
  7271.  
  7272.       forwarders This  statement takes an address list as an argument.  The IP
  7273.                 addresses in this list specify a list  of  name  servers  that
  7274.                 named  may query if it fails to resolve a query from its local
  7275.                 cache. They are tried in order until one of them  responds  to
  7276.                 the query.
  7277.  
  7278.  
  7279.           slave  This statement makes the name server a slave server. That is,
  7280.                 it will never perform recursive queries itself, but only  for-
  7281.                 wards them to servers specified with the forwarders statement.
  7282.  
  7283.  
  7284.  
  7285.  
  7286.  
  7287.  
  7288.  
  7289.  
  7290.                                  - 111 -
  7291.  
  7292.  
  7293.  
  7294.            There are two options  which  we  will  not  describe  here,  being
  7295.       sortlist and domain.  Additionally, there are two directives that may be
  7296.       used inside the zone database files. These  are  $INCLUDE  and  $ORIGIN.
  7297.       Since they are rarely needed, we will not describe them here, either.
  7298.  
  7299.  
  7300.  
  7301.  
  7302.  
  7303.       7.2.2  The DNS Database Files
  7304.  
  7305.       Master  files  included by named, like named.hosts, always have a domain
  7306.       associated with them, which is called the origin.  This  is  the  domain
  7307.       name  specified  with  the  cache  and primary commands. Within a master
  7308.       file, you are allowed to specify domain and host names relative to  this
  7309.       domain.   A name given in a configuration file is considered absolute if
  7310.       it ends in a single dot, otherwise it is considered relative to the ori-
  7311.       gin.  The origin all by itself may be referred to using ``@''.
  7312.  
  7313.  
  7314.              All  data  contained  in  a  master  file is split up in resource
  7315.       records, or RRs for short. They make up the smallest unit of information
  7316.       available  through  DNS. Each resource record has a type. A records, for
  7317.       instance, map a hostname to an IP address, and a CNAME record associates
  7318.       an  alias  for  a host with its official hostname. As an example, take a
  7319.       look at figure 7.2.3 on page 116, which  shows  the  named.hosts  master
  7320.       file for the virtual brewery.
  7321.  
  7322.  
  7323.            Resource record representations in master files share a common for-
  7324.       mat, which is
  7325.  
  7326.  
  7327.            [domain] [ttl] [class] type rdata
  7328.  
  7329.  
  7330.  
  7331.  
  7332.            Fields are separated by spaces or tabs. An entry may  be  continued
  7333.       across  several  lines  if an opening brace occurs before the first new-
  7334.       line, and the last field  is  followed  by  a  closing  brace.  Anything
  7335.       between a semicolon and a newline is ignored.
  7336.  
  7337.  
  7338.  
  7339.  
  7340.          domain This  is  the  domain  name  to which the entry applies. If no
  7341.                 domain name is given, the RR is assumed to apply to the domain
  7342.                 of the previous RR.
  7343.  
  7344.  
  7345.             ttl   In  order  to force resolvers to discard information after a
  7346.                 certain time, each RR is associated a ``time to live'', or ttl
  7347.                 for  short.  The  ttl  field specifies the time in seconds the
  7348.  
  7349.  
  7350.  
  7351.  
  7352.  
  7353.  
  7354.  
  7355.  
  7356.                                  - 112 -
  7357.  
  7358.  
  7359.  
  7360.                 information is valid after it  has  been  retrieved  from  the
  7361.                 server. It is a decimal number with at most eight digits.
  7362.  
  7363.  
  7364.                      If no ttl value is given, it defaults to the value of the
  7365.                 minimum field of the preceding SOA record.
  7366.  
  7367.  
  7368.           class This is an address class, like IN for IP addresses, or HS  for
  7369.                 objects  in  the Hesiod class. For TCP/IP networking, you have
  7370.                 to make this IN.
  7371.  
  7372.  
  7373.                      If no class field is given, the class of the preceding RR
  7374.                 is assumed.
  7375.  
  7376.  
  7377.            type This  describes  the type of the RR. The most common types are
  7378.                 A, SOA, PTR, and NS.  The following sections describe the var-
  7379.                 ious types of RR's.
  7380.  
  7381.  
  7382.           rdata This holds the data associated with the RR. The format of this
  7383.                 field depends on the  type  of  the  RR.  Below,  it  will  be
  7384.                 described for each RR separately.
  7385.  
  7386.  
  7387.  
  7388.  
  7389.  
  7390.  
  7391.       The  following  is  an  incomplete  list of RRs to be used in DNS master
  7392.       files. There are a couple more of them, which we will not explain.  They
  7393.       are experimental, and of little use generally.
  7394.  
  7395.  
  7396.  
  7397.  
  7398.             SOA
  7399.  
  7400.  
  7401.                      This  describes a zone of authority (SOA means ``Start of
  7402.                 Authority''). It signals that the records following the SOA RR
  7403.                 contain authoritative information for the domain. Every master
  7404.                 file included by a  primary  statement  must  contain  an  SOA
  7405.                 record for this zone. The resource data contains the following
  7406.                 fields:
  7407.  
  7408.  
  7409.  
  7410.  
  7411.                    origin This is the canonical hostname of the  primary  name
  7412.                           server  for  this  domain. It is usually given as an
  7413.                           absolute name.
  7414.  
  7415.  
  7416.  
  7417.  
  7418.  
  7419.  
  7420.  
  7421.  
  7422.                                  - 113 -
  7423.  
  7424.  
  7425.  
  7426.                   contact This is the email address of the person  responsible
  7427.                           for  maintaining  the domain, with the `@' character
  7428.                           replaced by a dot. For instance, if the  responsible
  7429.                           person  at  the  Virtual Brewery is janet, then this
  7430.                           field would contain janet.vbrew.com.
  7431.  
  7432.  
  7433.                    serial This  is  the  version  number  of  the  zone  file,
  7434.                           expressed  as a single decimal number. Whenever data
  7435.                           is changed in the zone file, this number  should  be
  7436.                           incremented.
  7437.  
  7438.  
  7439.                                The  serial  number  is  used by secondary name
  7440.                           servers  to  recognize  when  zone  information  has
  7441.                           changed.  To  stay  up  to  date,  secondary servers
  7442.                           request the primary server's SOA record  at  certain
  7443.                           intervals,  and compare the serial number to that of
  7444.                           the cached SOA record.  If the number  has  changed,
  7445.                           the  secondary  servers  transfers  the  whole  zone
  7446.                           database from the primary server.
  7447.  
  7448.  
  7449.                   refresh This specifies the interval in seconds that the sec-
  7450.                           ondary  servers should wait between checking the SOA
  7451.                           record of the primary server. Again, this is a deci-
  7452.                           mal number with at most eight digits.
  7453.  
  7454.  
  7455.                                Generally,  the network topology doesn't change
  7456.                           too often, so that this  number  should  specify  an
  7457.                           interval  of  roughly a day for larger networks, and
  7458.                           even more for smaller ones.
  7459.  
  7460.  
  7461.                     retry This number determines the intervals at which a sec-
  7462.                           ondary  server  should  retry contacting the primary
  7463.                           server if a request or a zone refresh fails. It must
  7464.                           not  be  too low, or else a temporary failure of the
  7465.                           server or a network problem may cause the  secondary
  7466.                           server  to  waste  network  resources.  One hour, or
  7467.                           perhaps one half hour, might be a good choice.
  7468.  
  7469.  
  7470.                    expire This specifies the time in seconds after  which  the
  7471.                           server  should  finally  discard all zone data if it
  7472.                           hasn't been able to contact the primary  server.  It
  7473.                           should  normally be very large.  Craig Hunt ([ GETST
  7474.                           "hunt-tcpip" ]) recommends 42 days.
  7475.  
  7476.  
  7477.                   minimum This is the default ttl value for  resource  records
  7478.                           that  do  not  explicitly specify one. This requires
  7479.                           other name servers to discard the RR after a certain
  7480.  
  7481.  
  7482.  
  7483.  
  7484.  
  7485.  
  7486.  
  7487.  
  7488.                                  - 114 -
  7489.  
  7490.  
  7491.  
  7492.                           amount  of  time.  It has however nothing to do with
  7493.                           the time after which a  secondary  server  tries  to
  7494.                           update the zone information.
  7495.  
  7496.  
  7497.                                minimum should be a large value, especially for
  7498.                           LANs  where  the  network  topology   almost   never
  7499.                           changes.   A  value  of  around a week or a month is
  7500.                           probably a good choice. In the case that single  RRs
  7501.                           may  change  more  frequently,  you can still assign
  7502.                           them different ttl's.
  7503.  
  7504.  
  7505.  
  7506.  
  7507.  
  7508.               A
  7509.  
  7510.  
  7511.                      This associates  an  IP  address  with  a  hostname.  The
  7512.                 resource  data field contains the address in dotted quad nota-
  7513.                 tion.
  7514.  
  7515.  
  7516.                       For each host, there must be  only  one  A  record.  The
  7517.                 hostname  used  in this A record is considered the official or
  7518.                 canonical hostname.  All other hostnames are aliases and  must
  7519.                 be mapped onto the canonical hostname using a CNAME record.
  7520.  
  7521.  
  7522.              NS
  7523.  
  7524.  
  7525.                      This  points  to  a  master  name server of a subordinate
  7526.                 zone. For an explanation why one has to have NS  records,  see
  7527.                 section 3.6.  The resource data field contains the hostname of
  7528.                 the name server. To resolve  the  hostname,  an  additional  A
  7529.                 record  is  needed,  the so-called glue record which gives the
  7530.                 name server's IP address.
  7531.  
  7532.  
  7533.           CNAME
  7534.  
  7535.  
  7536.                      This associates an alias for a host  with  its  canonical
  7537.                 hostname.   The  canonical hostname is the one the master file
  7538.                 provides an A record for; aliases are simply  linked  to  that
  7539.                 name  by  a  CNAME record, but don't have any other records of
  7540.                 their own.
  7541.  
  7542.  
  7543.             PTR
  7544.  
  7545.  
  7546.  
  7547.  
  7548.  
  7549.  
  7550.  
  7551.  
  7552.  
  7553.  
  7554.                                  - 115 -
  7555.  
  7556.  
  7557.  
  7558.                      This type of record is used to associate names in the in-
  7559.                 addr.arpa domain with hostnames. This is used for reverse map-
  7560.                 ping of IP addresses to hostnames. The hostname given must  be
  7561.                 the canonical hostname.
  7562.  
  7563.  
  7564.              MX
  7565.  
  7566.  
  7567.                      This RR announces a mail exchanger for a domain. The rea-
  7568.                 sons to have mail exchangers are discussed in  section  14.4.1
  7569.                 in chapter 14..  The syntax of an MX record is
  7570.  
  7571.  
  7572.                      [domain] [ttl] [class] MX preference host
  7573.  
  7574.  
  7575.  
  7576.  
  7577.                      host names the mail  exchanger  for  domain.  Every  mail
  7578.                 exchanger  has  an  integer  preference associated with it.  A
  7579.                 mail transport agent who desires to  deliver  mail  to  domain
  7580.                 will try all hosts who have an MX record for this domain until
  7581.                 it succeeds. The one with the lowest preference value is tried
  7582.                 first,  then  the  others  in  order  of increasing preference
  7583.                 value.
  7584.  
  7585.  
  7586.           HINFO This record provides information on the system's hardware  and
  7587.                 software. Its syntax is
  7588.  
  7589.  
  7590.                      [domain] [ttl] [class] HINFO hardware software
  7591.  
  7592.  
  7593.  
  7594.  
  7595.                      The hardware field identifies the hardware used  by  this
  7596.                 host.   There  are special conventions to specify this. A list
  7597.                 of valid names is  given  in  the  ``Assigned  Numbers''  (RFC
  7598.                 1340).  If  the field contains any blanks, it must be enclosed
  7599.                 in double quotes.  The software field names the operating sys-
  7600.                 tem  software used by the system. Again, a valid name from the
  7601.                 ``Assigned Numbers'' RFC should be chosen.
  7602.  
  7603.  
  7604.  
  7605.       7.2.3  Writing the Master Files
  7606.  
  7607.       Figures 7.2.3, 7.2.3, 7.2.3, and 7.2.3 give  sample  files  for  a  name
  7608.       server  at  the  brewery,  located on vlager. Owing to the nature of the
  7609.       network discussed (a single LAN), the example is pretty straightforward.
  7610.       If  your  requirements  are more complex, and you can't get named going,
  7611.       get ``DNS and BIND'' by Cricket Liu and Paul Albitz ([  GETST  "liu-dns"
  7612.  
  7613.  
  7614.  
  7615.  
  7616.  
  7617.  
  7618.  
  7619.  
  7620.                                  - 116 -
  7621.  
  7622.  
  7623.  
  7624.       ]).
  7625.  
  7626.  
  7627.              The  named.ca  cache file shown in figure 7.2.3 shows sample hint
  7628.       records for a root name server. A typical cache file  usually  describes
  7629.       about  a  dozen  name servers, or so. You can obtain the current list of
  7630.       name servers for the root  domain  using  the  nslookup  tool  described
  7631.       toward the end of this chapter.(3)
  7632.  
  7633.  
  7634.  
  7635.  
  7636.  
  7637.  
  7638.  
  7639.  
  7640.  
  7641.  
  7642.  
  7643.  
  7644.  
  7645.                 ;
  7646.                 ; /var/named/named.ca          Cache file for the brewery.
  7647.                 ;                We're not on the Internet, so we don't need
  7648.                 ;                any root servers. To activate these
  7649.                 ;                records, remove the semicolons.
  7650.                 ;
  7651.                 ; .                99999999   IN    NS  NS.NIC.DDN.MIL
  7652.                 ; NS.NIC.DDN.MIL   99999999   IN    A   26.3.0.103
  7653.                 ; .                99999999   IN    NS  NS.NASA.GOV
  7654.                 ; NS.NASA.GOV      99999999   IN    A   128.102.16.10
  7655.  
  7656.  
  7657.  
  7658.  
  7659.  
  7660.                      Figure 10.   The named.ca file.
  7661.  
  7662.  
  7663.  
  7664.  
  7665.  
  7666.  
  7667.       7.2.4  Verifying the Name Server Setup
  7668.  
  7669.  
  7670.  
  7671.  
  7672.       
  7673.  
  7674.       3. Note  that  you can't query your name server for the root
  7675.          servers  if  you  don't  have  any  root   server   hints
  7676.          installed:  Catch  22!  To  escape  this dilemma, you can
  7677.          either make nslookup use a different name server, or  you
  7678.          can  use  the  sample  file in figure 7.2.3 as a starting
  7679.          point, and then obtain the full list of valid servers.
  7680.  
  7681.  
  7682.  
  7683.  
  7684.  
  7685.  
  7686.  
  7687.                                  - 117 -
  7688.  
  7689.  
  7690.  
  7691.  
  7692.  
  7693.  
  7694.  
  7695.                 ;
  7696.                 ; /var/named/named.hosts       Local hosts at the brewery
  7697.                 ;                               Origin is vbrew.com
  7698.                 ;
  7699.                 @                   IN  SOA   vlager.vbrew.com. (
  7700.                                               janet.vbrew.com.
  7701.                                               16         ; serial
  7702.                                               86400      ; refresh: once per day
  7703.                                               3600       ; retry:   one hour
  7704.                                               3600000    ; expire:  42 days
  7705.                                               604800     ; minimum: 1 week
  7706.                                               )
  7707.                                     IN  NS    vlager.vbrew.com.
  7708.                 ;
  7709.                 ; local mail is distributed on vlager
  7710.                                     IN  MX    10 vlager
  7711.                 ;
  7712.                 ; loopback address
  7713.                 localhost.          IN  A     127.0.0.1
  7714.                 ; brewery Ethernet
  7715.                 vlager              IN  A     191.72.1.1
  7716.                 vlager-if1          IN  CNAME vlager
  7717.                 ; vlager is also news server
  7718.                 news                IN  CNAME vlager
  7719.                 vstout              IN  A     191.72.1.2
  7720.                 vale                IN  A     191.72.1.3
  7721.                 ; winery Ethernet
  7722.                 vlager-if2          IN  A     191.72.2.1
  7723.                 vbardolino          IN  A     191.72.2.2
  7724.                 vchianti            IN  A     191.72.2.3
  7725.                 vbeaujolais         IN  A     191.72.2.4
  7726.  
  7727.  
  7728.  
  7729.  
  7730.  
  7731.                     Figure 11.   The named.hosts file.
  7732.  
  7733.            There's a fine tool for checking the operation of your name  server
  7734.       setup.  It  is  called  nslookup, and may be used both interactively and
  7735.       from the command line. In the latter case, you simply invoke it as
  7736.  
  7737.  
  7738.            nslookup hostname
  7739.  
  7740.  
  7741.  
  7742.  
  7743.       and it will query the name server specified in resolv.conf for hostname.
  7744.       (If  this  file  names more than one server, nslookup will choose one at
  7745.  
  7746.  
  7747.  
  7748.  
  7749.  
  7750.  
  7751.  
  7752.  
  7753.                                  - 118 -
  7754.  
  7755.  
  7756.  
  7757.  
  7758.  
  7759.  
  7760.  
  7761.                 ;
  7762.                 ; /var/named/named.local       Reverse mapping of 127.0.0
  7763.                 ;                               Origin is 0.0.127.in-addr.arpa.
  7764.                 ;
  7765.                 @                   IN  SOA   vlager.vbrew.com. (
  7766.                                               joe.vbrew.com.
  7767.                                               1          ; serial
  7768.                                               360000     ; refresh: 100 hrs
  7769.                                               3600       ; retry:   one hour
  7770.                                               3600000    ; expire:  42 days
  7771.                                               360000     ; minimum: 100 hrs
  7772.                                               )
  7773.                                     IN  NS    vlager.vbrew.com.
  7774.                 1                   IN  PTR   localhost.
  7775.  
  7776.  
  7777.  
  7778.  
  7779.  
  7780.                     Figure 12.   The named.local file.
  7781.  
  7782.       random).
  7783.  
  7784.  
  7785.            The interactive mode, however, is much more exciting. Besides look-
  7786.       ing  up  individual hosts, you may query for any type of DNS record, and
  7787.       transfer the entire zone information for a domain.
  7788.  
  7789.  
  7790.            When invoked without  argument,  nslookup  will  display  the  name
  7791.       server  it  uses, and enter interactive mode. At the `>' prompt, you may
  7792.       type any domain name it should query for. By default, it asks for  class
  7793.       A  records, those containing the IP address relating to the domain name.
  7794.  
  7795.  
  7796.            You may change this type by issuing ``set type=type'',  where  type
  7797.       is  one  of the resource record names described above in section 7.2, or
  7798.       ANY.
  7799.  
  7800.  
  7801.            For example, you might have the following dialogue with it:
  7802.  
  7803.  
  7804.  
  7805.  
  7806.  
  7807.  
  7808.  
  7809.  
  7810.  
  7811.  
  7812.  
  7813.  
  7814.  
  7815.  
  7816.  
  7817.  
  7818.  
  7819.                                  - 119 -
  7820.  
  7821.  
  7822.  
  7823.  
  7824.  
  7825.  
  7826.  
  7827.                 ;
  7828.                 ; /var/named/named.rev         Reverse mapping of our IP addresses
  7829.                 ;                               Origin is 72.191.in-addr.arpa.
  7830.                 ;
  7831.                 @                   IN  SOA   vlager.vbrew.com. (
  7832.                                               joe.vbrew.com.
  7833.                                               16         ; serial
  7834.                                               86400      ; refresh: once per day
  7835.                                               3600       ; retry:   one hour
  7836.                                               3600000    ; expire:  42 days
  7837.                                               604800     ; minimum: 1 week
  7838.                                               )
  7839.                                     IN  NS    vlager.vbrew.com.
  7840.                 ; brewery
  7841.                 1.1                 IN  PTR   vlager.vbrew.com.
  7842.                 2.1                 IN  PTR   vstout.vbrew.com.
  7843.                 3.1                 IN  PTR   vale.vbrew.com.
  7844.                 ; winery
  7845.                 1.2                 IN  PTR   vlager-if1.vbrew.com.
  7846.                 2.2                 IN  PTR   vbardolino.vbrew.com.
  7847.                 3.2                 IN  PTR   vchianti.vbrew.com.
  7848.                 4.2                 IN  PTR   vbeaujolais.vbrew.com.
  7849.  
  7850.  
  7851.  
  7852.  
  7853.  
  7854.                      Figure 13.   The named.rev file.
  7855.  
  7856.            $ nslookup
  7857.            Default Name Server:  rs10.hrz.th-darmstadt.de
  7858.            Address:  130.83.56.60
  7859.  
  7860.            > sunsite.unc.edu
  7861.            Name Server:  rs10.hrz.th-darmstadt.de
  7862.            Address:  130.83.56.60
  7863.  
  7864.            Non-authoritative answer:
  7865.            Name:    sunsite.unc.edu
  7866.            Address:  152.2.22.81
  7867.  
  7868.  
  7869.  
  7870.  
  7871.            If  you  try to query for a name that has no IP address associated,
  7872.       but other records were found in the DNS  database,  nslookup  will  come
  7873.       back with an error message saying ``No type A records found''.  However,
  7874.       you can make it query for records other than type A by issuing the ``set
  7875.       type'' command. For example, to get the SOA record of unc.edu, you would
  7876.       issue:
  7877.  
  7878.  
  7879.  
  7880.  
  7881.  
  7882.  
  7883.  
  7884.  
  7885.                                  - 120 -
  7886.  
  7887.  
  7888.  
  7889.            > unc.edu
  7890.            *** No address (A) records available for unc.edu
  7891.            Name Server:  rs10.hrz.th-darmstadt.de
  7892.            Address:  130.83.56.60
  7893.  
  7894.            > set type=SOA
  7895.            > unc.edu
  7896.            Name Server:  rs10.hrz.th-darmstadt.de
  7897.            Address:  130.83.56.60
  7898.  
  7899.            Non-authoritative answer:
  7900.            unc.edu
  7901.                    origin = ns.unc.edu
  7902.                    mail addr = shava.ns.unc.edu
  7903.                    serial = 930408
  7904.                    refresh = 28800 (8 hours)
  7905.                    retry   = 3600 (1 hour)
  7906.                    expire  = 1209600 (14 days)
  7907.                    minimum ttl = 86400 (1 day)
  7908.  
  7909.            Authoritative answers can be found from:
  7910.            UNC.EDU nameserver = SAMBA.ACS.UNC.EDU
  7911.            SAMBA.ACS.UNC.EDU       internet address = 128.109.157.30
  7912.  
  7913.  
  7914.  
  7915.  
  7916.            In  a  similar  fashion you can query for MX records, etc.  Using a
  7917.       type of ANY returns all resource records associated with a given name.
  7918.  
  7919.  
  7920.  
  7921.            > set type=MX
  7922.            > unc.edu
  7923.            Non-authoritative answer:
  7924.            unc.edu preference = 10, mail exchanger = lambada.oit.unc.edu
  7925.            lambada.oit.unc.edu     internet address = 152.2.22.80
  7926.  
  7927.            Authoritative answers can be found from:
  7928.            UNC.EDU nameserver = SAMBA.ACS.UNC.EDU
  7929.            SAMBA.ACS.UNC.EDU       internet address = 128.109.157.30
  7930.  
  7931.  
  7932.  
  7933.  
  7934.             A practical application of nslookup beside debugging is to  obtain
  7935.       the  current list of root name servers for the named.ca file. You can do
  7936.       this by querying for all  type  NS  records  associated  with  the  root
  7937.       domain:
  7938.  
  7939.  
  7940.  
  7941.  
  7942.  
  7943.  
  7944.  
  7945.  
  7946.  
  7947.  
  7948.  
  7949.  
  7950.  
  7951.                                  - 121 -
  7952.  
  7953.  
  7954.  
  7955.            > set typ=NS
  7956.            > .
  7957.            Name Server:  fb0430.mathematik.th-darmstadt.de
  7958.            Address:  130.83.2.30
  7959.  
  7960.            Non-authoritative answer:
  7961.            (root)  nameserver = NS.INTERNIC.NET
  7962.            (root)  nameserver = AOS.ARL.ARMY.MIL
  7963.            (root)  nameserver = C.NYSER.NET
  7964.            (root)  nameserver = TERP.UMD.EDU
  7965.            (root)  nameserver = NS.NASA.GOV
  7966.            (root)  nameserver = NIC.NORDU.NET
  7967.            (root)  nameserver = NS.NIC.DDN.MIL
  7968.  
  7969.            Authoritative answers can be found from:
  7970.            (root)  nameserver = NS.INTERNIC.NET
  7971.            (root)  nameserver = AOS.ARL.ARMY.MIL
  7972.            (root)  nameserver = C.NYSER.NET
  7973.            (root)  nameserver = TERP.UMD.EDU
  7974.            (root)  nameserver = NS.NASA.GOV
  7975.            (root)  nameserver = NIC.NORDU.NET
  7976.            (root)  nameserver = NS.NIC.DDN.MIL
  7977.            NS.INTERNIC.NET internet address = 198.41.0.4
  7978.            AOS.ARL.ARMY.MIL        internet address = 128.63.4.82
  7979.            AOS.ARL.ARMY.MIL        internet address = 192.5.25.82
  7980.            AOS.ARL.ARMY.MIL        internet address = 26.3.0.29
  7981.            C.NYSER.NET     internet address = 192.33.4.12
  7982.            TERP.UMD.EDU    internet address = 128.8.10.90
  7983.            NS.NASA.GOV     internet address = 128.102.16.10
  7984.            NS.NASA.GOV     internet address = 192.52.195.10
  7985.            NS.NASA.GOV     internet address = 45.13.10.121
  7986.            NIC.NORDU.NET   internet address = 192.36.148.17
  7987.            NS.NIC.DDN.MIL  internet address = 192.112.36.4
  7988.  
  7989.  
  7990.  
  7991.  
  7992.            The  complete  set  of  commands  available  with  nslookup  may be
  7993.       obtained by the help command from within nslookup.
  7994.  
  7995.  
  7996.  
  7997.  
  7998.  
  7999.       7.2.5  Other Useful Tools
  8000.  
  8001.  
  8002.  
  8003.  
  8004.            There are a few tools that can help you with your tasks as  a  BIND
  8005.       administrator.  I  will briefly describe two of them here.  Please refer
  8006.       to the documentation that comes with these tools for information on  how
  8007.       to use them.
  8008.  
  8009.  
  8010.  
  8011.  
  8012.  
  8013.  
  8014.  
  8015.  
  8016.  
  8017.                                  - 122 -
  8018.  
  8019.  
  8020.  
  8021.             hostcvt is a tool that helps you with your initial BIND configura-
  8022.       tion by converting your /etc/hosts file into master files for named.  It
  8023.       generates  both  the  forward (A) and reverse mapping (PTR) entries, and
  8024.       takes care of aliases and the like. Of course, it won't do the whole job
  8025.       for  you,  as  you  may still want to tune the timeout values in the SOA
  8026.       record, for instance, or add MX records and the like. Still, it may help
  8027.       you  save  a  few  aspirins. hostcvt is part of the BIND source, but can
  8028.       also be found as a standalone package on a few Linux FTP servers.
  8029.  
  8030.  
  8031.             After setting up your name server, you may want to test your  con-
  8032.       figuration.   The  ideal  (and,  to  my knowledge) only tool for this is
  8033.       dnswalk, a perl-based package that walks your DNS database, looking  for
  8034.       common  mistakes  and  verifying  that  the  information  is consistent.
  8035.       dnswalk has been released on comp.sources.misc recently, and  should  be
  8036.       available on all FTP sites that archive this group (ftp.uu.net should be
  8037.       a safe bet if you don't know of any such site near you).
  8038.  
  8039.  
  8040.  
  8041.  
  8042.  
  8043.  
  8044.  
  8045.  
  8046.  
  8047.  
  8048.  
  8049.  
  8050.  
  8051.  
  8052.  
  8053.  
  8054.  
  8055.  
  8056.  
  8057.  
  8058.  
  8059.  
  8060.  
  8061.  
  8062.  
  8063.  
  8064.  
  8065.  
  8066.  
  8067.  
  8068.  
  8069.  
  8070.  
  8071.  
  8072.  
  8073.  
  8074.  
  8075.  
  8076.  
  8077.  
  8078.  
  8079.  
  8080.  
  8081.  
  8082.  
  8083.                                  - 123 -
  8084.  
  8085.  
  8086.  
  8087.       8.  Serial Line IP
  8088.  
  8089.  
  8090.  
  8091.  
  8092.            The serial line protocols, SLIP and PPP, provide the Internet  con-
  8093.       nectivity  for  the poor. Apart from a modem and a serial board equipped
  8094.       with a FIFO buffer, no hardware is needed. Using it  is  not  much  more
  8095.       complicated  than a mailbox, and an increasing number of private organi-
  8096.       zations offer dial-up IP at an affordable cost to everyone.
  8097.  
  8098.  
  8099.            There are both SLIP and PPP drivers available for Linux.  SLIP  has
  8100.       been  there  for quite a while, and works fairly reliable.  A PPP driver
  8101.       has been developed recently by Michael Callahan  and  Al  Longyear.   It
  8102.       will be described in the next chapter.
  8103.  
  8104.  
  8105.       8.1  General Requirements
  8106.  
  8107.  
  8108.  
  8109.  
  8110.            To  use  SLIP  or  PPP, you have to configure some basic networking
  8111.       features as described in the previous chapters, of course. At the least,
  8112.       you  have  to set up the looback interface, and provide for name resolu-
  8113.       tion. When connecting to the Internet, you will of course  want  to  use
  8114.       DNS.  The simplest option is to put the address of some name server into
  8115.       your resolv.conf file; this server will be queried as soon as  the  SLIP
  8116.       link is activated. The closer this name server is to the point where you
  8117.       dial in, the better.
  8118.  
  8119.  
  8120.             However, this solution is not optimal, because  all  name  lookups
  8121.       will  still  go through your SLIP/PPP link. If you worry about the band-
  8122.       width this consumes, you can also set up a caching-only name server.  It
  8123.       doesn't  really  serve  a  domain,  but only acts as a relay for all DNS
  8124.       queries produced on your host. The advantage of this scheme is  that  it
  8125.       builds  up a cache, so that most queries have to be sent over the serial
  8126.       line only once. A named.boot file for a caching-only server  looks  like
  8127.       this:
  8128.  
  8129.  
  8130.  
  8131.            ; named.boot file for caching-only server
  8132.            directory                            /var/named
  8133.  
  8134.            primary       0.0.127.in-addr.arpa   db.127.0.0 ; loopback net
  8135.            cache         .                      db.cache   ; root servers
  8136.  
  8137.  
  8138.  
  8139.  
  8140.            In addition to this name.boot file, you also have  to  set  up  the
  8141.  
  8142.  
  8143.  
  8144.  
  8145.  
  8146.  
  8147.  
  8148.  
  8149.                                  - 124 -
  8150.  
  8151.  
  8152.  
  8153.       db.cache file with a valid list of root name servers.  This is described
  8154.       toward the end of the Resolver Configuration chapter.
  8155.  
  8156.  
  8157.       8.2  SLIP Operation
  8158.  
  8159.  
  8160.  
  8161.  
  8162.            Dial-up IP servers frequently offer SLIP  service  through  special
  8163.       user  accounts.  After logging into such an account, you are not dropped
  8164.       into the common shell; instead a program or  shell  script  is  executed
  8165.       that enables the server's SLIP driver for the serial line and configures
  8166.       the appropriate network interface. Then you have to do the same at  your
  8167.       end of the link.
  8168.  
  8169.  
  8170.            On some operating systems, the SLIP driver is a user-space program;
  8171.       under Linux, it is part of the kernel, which  makes  it  a  lot  faster.
  8172.       This  requires,  however, that the serial line be converted to SLIP mode
  8173.       explicitly. This is done by means of  a  special  tty  line  discipline,
  8174.       SLIPDISC.  While  the  tty is in normal line discipline (DISC0), it will
  8175.       exchange data only with user processes, using  the  normal  read(2)  and
  8176.       write(2)  calls,  and the SLIP driver is unable to write to or read from
  8177.       the tty. In SLIPDISC, the roles are reversed: now  any  user-space  pro-
  8178.       cesses  are  blocked  from writing to or reading from the tty, while all
  8179.       data coming in on the serial port will be passed directly  to  the  SLIP
  8180.       driver.
  8181.  
  8182.  
  8183.              The  SLIP driver itself understands a number of variations on the
  8184.       SLIP protocol. Apart from ordinary  SLIP,  it  also  understands  CSLIP,
  8185.       which performs the so-called Van Jacobson header compression on outgoing
  8186.       IP packets.(1) This improves throughput for interactive sessions notice-
  8187.       ably.  Additionally, there are six-bit versions for each of these proto-
  8188.       cols.
  8189.  
  8190.  
  8191.             A simple way to convert a serial line to SLIP mode is by using the
  8192.       slattach tool. Assume you have your modem on /dev/cua3, and have  logged
  8193.       into the SLIP server successfully. You will then execute:
  8194.  
  8195.  
  8196.            # slattach /dev/cua3 &
  8197.  
  8198.  
  8199.  
  8200.            This  will  switch  the  line  discipline  of cua3 to SLIPDISC, and
  8201.       attach it to one of the SLIP network interfaces. If this is  your  first
  8202.       active  SLIP link, the line will be attached to sl0; the second would be
  8203.       attached to sl1, and so on. The current  kernels  support  up  to  eight
  8204.       simultaneous SLIP links.
  8205.  
  8206.       
  8207.  
  8208.       1. Van Jacobson header compression is described in RFC 1441.
  8209.  
  8210.  
  8211.  
  8212.  
  8213.  
  8214.  
  8215.  
  8216.                                  - 125 -
  8217.  
  8218.  
  8219.  
  8220.              The  default  encapsulation chosen by slattach is CSLIP.  You may
  8221.       choose any other mode using the -p switch.  To use normal SLIP (no  com-
  8222.       pression), you would use
  8223.  
  8224.  
  8225.            # slattach -p slip /dev/cua3 &
  8226.  
  8227.  
  8228.  
  8229.            Other  modes  are  cslip, slip6, cslip6 (for the six-bit version of
  8230.       SLIP), and adaptive for adaptive SLIP.  The latter leaves it to the ker-
  8231.       nel to find out which type of SLIP encapsulation the remote end uses.
  8232.  
  8233.  
  8234.            Note  that  you  must use the same encapsulation as your peer does.
  8235.       For example, if cowslip uses CSLIP, you have to do so, too.   The  symp-
  8236.       toms  of  a  mismatch  will  be  that a ping to the remote host will not
  8237.       receive any packets back.  If the other host pings you, you may also see
  8238.       messages  like  ``Can't  build ICMP header'' on your console. One way to
  8239.       avoid these difficulties is to use adaptive SLIP.
  8240.  
  8241.  
  8242.            In fact, slattach does not only allow you to enable SLIP, but other
  8243.       protocols  that  use  the serial line as well, like PPP or KISS (another
  8244.       protocol used by ham radio people).  For details, please  refer  to  the
  8245.       slattach(8) manual page.
  8246.  
  8247.  
  8248.            After turning over the line to the SLIP driver, you have to config-
  8249.       ure the network interface. Again, we do this using the standard ifconfig
  8250.       and  route commands. Assume that from vlager, we have dialed up a server
  8251.       named cowslip. You would then execute
  8252.  
  8253.  
  8254.  
  8255.            # ifconfig sl0 vlager pointopoint cowslip
  8256.            # route add cowslip
  8257.            # route add default gw cowslip
  8258.  
  8259.  
  8260.  
  8261.  
  8262.            The first command configures the interface as a point-to-point link
  8263.       to cowslip, while the second and third add the route to cowslip and  the
  8264.       default route using cowslip as a gateway.
  8265.  
  8266.  
  8267.            When taking down the SLIP link, you first have to remove all routes
  8268.       through cowslip using route with the  del  option,  take  the  interface
  8269.       down,  and send slattach the hangup signal.  Afterwards you have to hang
  8270.       up the modem using your terminal program again:
  8271.  
  8272.  
  8273.  
  8274.  
  8275.  
  8276.  
  8277.  
  8278.  
  8279.  
  8280.  
  8281.  
  8282.                                  - 126 -
  8283.  
  8284.  
  8285.  
  8286.            # route del default
  8287.            # route del cowslip
  8288.            # ifconfig sl0 down
  8289.            # kill -HUP 516
  8290.  
  8291.  
  8292.  
  8293.       8.3  Using dip
  8294.  
  8295.  
  8296.  
  8297.  
  8298.            Now,  that was rather simple. Nevertheless, you might want to auto-
  8299.       mate the above steps so that you only have to invoke  a  simple  command
  8300.       that  performs  all  steps  shown above. This is what dip is for.(2) The
  8301.       current release as of this writing is version 3.3.7. It has been patched
  8302.       very  heavily  by a number of people, so that you can't speak of the dip
  8303.       program anymore. These different strains of development  will  hopefully
  8304.       be merged in a future release.
  8305.  
  8306.  
  8307.            dip  provides  an  interpreter for a simple scripting language that
  8308.       can handle the modem for you, convert the line to SLIP mode, and config-
  8309.       ure  the interfaces.  This is rather primitive and restrictive, but suf-
  8310.       ficient for most cases. A new release of dip may feature a  more  versa-
  8311.       tile language one day.
  8312.  
  8313.  
  8314.              To  be  able  to  configure the SLIP interface, dip requires root
  8315.       privilege. It would now be tempting to make dip setuid to root, so  that
  8316.       all  users can dial up some SLIP server without having to give them root
  8317.       access. This is very dangerous, because setting up bogus interfaces  and
  8318.       default routes with dip may disrupt routing on your network badly.  Even
  8319.       worse, this will give your users  the  power  to  connect  to  any  SLIP
  8320.       server,  and launch dangerous attacks on your network. So if you want to
  8321.       allow your users to fire up a SLIP connection, write small wrapper  pro-
  8322.       grams  for  each prospective SLIP server, and have these wrappers invoke
  8323.       dip with the specific script that establishes the connection. These pro-
  8324.       grams can then safely be made setuid root.(3)
  8325.  
  8326.  
  8327.       8.3.1  A Sample Script
  8328.  
  8329.  
  8330.  
  8331.  
  8332.            A sample script is produced in figure 8.3.1. It can be used to con-
  8333.       nect to cowslip by invoking dip with the script name as argument:
  8334.  
  8335.  
  8336.  
  8337.  
  8338.       2. dip means Dialup IP. It was written by Fred van Kempen.
  8339.       3. diplogin  can  (and  must)  be  run  setuid, too. See the
  8340.          section at the end of this chapter.
  8341.  
  8342.  
  8343.  
  8344.  
  8345.  
  8346.  
  8347.  
  8348.                                  - 127 -
  8349.  
  8350.  
  8351.  
  8352.  
  8353.  
  8354.             # Sample dip script for dialing up cowslip
  8355.  
  8356.             # Set local and remote name and address
  8357.             get $local vlager
  8358.             get $remote cowslip
  8359.  
  8360.             port cua3                # choose a serial port
  8361.             speed 38400              # set speed to max
  8362.             modem HAYES              # set modem type
  8363.             reset                    # reset modem and tty
  8364.             flush                    # flush out modem response
  8365.  
  8366.             # Prepare for dialing.
  8367.             send ATQ0V1E1X1\r
  8368.             wait OK 2
  8369.             if $errlvl != 0 goto error
  8370.             dial 41988
  8371.             if $errlvl != 0 goto error
  8372.             wait CONNECT 60
  8373.             if $errlvl != 0 goto error
  8374.  
  8375.             # Okay, we're connected now
  8376.             sleep 3
  8377.             send \r\n\r\n
  8378.             wait ogin: 10
  8379.             if $errlvl != 0 goto error
  8380.             send Svlager\n
  8381.             wait ssword: 5
  8382.             if $errlvl != 0 goto error
  8383.             send hey-jude\n
  8384.             wait running 30
  8385.             if $errlvl != 0 goto error
  8386.  
  8387.             # We have logged in, and the remote side is firing up SLIP.
  8388.             print Connected to $remote with address $rmtip
  8389.             default                  # Make this link our default route
  8390.             mode SLIP                # We go to SLIP mode, too
  8391.             # fall through in case of error
  8392.  
  8393.            error:
  8394.             print SLIP to $remote failed.
  8395.  
  8396.  
  8397.  
  8398.                      Figure 14.   A sample dip script
  8399.  
  8400.  
  8401.  
  8402.  
  8403.  
  8404.  
  8405.  
  8406.  
  8407.  
  8408.  
  8409.  
  8410.  
  8411.  
  8412.  
  8413.  
  8414.                                  - 128 -
  8415.  
  8416.  
  8417.  
  8418.            # dip cowslip.dip
  8419.            DIP: Dialup IP Protocol Driver version 3.3.7 (12/13/93)
  8420.            Written by Fred N. van Kempen, MicroWalt Corporation.
  8421.  
  8422.            connected to cowslip.moo.com with addr 193.174.7.129
  8423.            #
  8424.  
  8425.  
  8426.  
  8427.  
  8428.            After connecting to cowslip and enabling SLIP, dip will detach from
  8429.       the terminal and go to the background. You can then start using the nor-
  8430.       mal  networking  services on the SLIP link. To terminate the connection,
  8431.       simply invoke dip with the -k option. This sends a hangup signal to  dip
  8432.       process, using the process id dip records in /etc/dip.pid:(4)
  8433.  
  8434.  
  8435.  
  8436.            # kill -k
  8437.  
  8438.  
  8439.  
  8440.  
  8441.            In dip's scripting language, keywords prefixed with a dollar symbol
  8442.       denote variable names.  dip has a predefined set of variables which will
  8443.       be listed below.  $remote and $local, for instance,  contain  the  host-
  8444.       names of the local and remote host involved in the SLIP link.
  8445.  
  8446.  
  8447.            The  first  two  statements  in the sample script are get commands,
  8448.       which is dip's way to set a variable. Here, the local and  remote  host-
  8449.       name are set to vlager and cowslip, respectively.
  8450.  
  8451.  
  8452.              The  next five statements set up the terminal line and the modem.
  8453.       The reset sends a  reset  string  to  the  modem;  for  Hayes-compatible
  8454.       modems,  this  is  the  ATZ command.  The next statement flushes out the
  8455.       modem response, so that the login chat in the next few lines  will  work
  8456.       properly.  This  chat is pretty straight-forward: it simply dials 41988,
  8457.       the phone number of cowslip, and logs into the account Svlager using the
  8458.       password  hey-jude. The wait command makes dip wait for the string given
  8459.       as its first argument; the number given as second argument make the wait
  8460.       time  out after that many seconds if no such string is received.  The if
  8461.       commands interspersed in the login procedure check  that  no  error  has
  8462.       occurred while executing the command.
  8463.  
  8464.  
  8465.            The  final  commands  executed  after logging in are default, which
  8466.       makes the SLIP link the default route to  all  hosts,  and  mode,  which
  8467.       enables  SLIP  mode on the line and configures the interface and routing
  8468.       table for you.
  8469.  
  8470.       
  8471.  
  8472.       4. See  the  newsgroup alt.tla for more palindromic fun with
  8473.          three-letter acronyms.
  8474.  
  8475.  
  8476.  
  8477.  
  8478.  
  8479.  
  8480.  
  8481.                                  - 129 -
  8482.  
  8483.  
  8484.  
  8485.       8.3.2  A dip Reference
  8486.  
  8487.       Although widely used, dip hasn't been very well documented yet.  In this
  8488.       section,  we will therefore give a reference for most of dip's commands.
  8489.       You can get an overview of all commands it provides by invoking  dip  in
  8490.       test  mode,  and entering the help command. To find out about the syntax
  8491.       of a command, you may enter it without any  arguments;  of  course  this
  8492.       does not work with commands that take no arguments.
  8493.  
  8494.  
  8495.  
  8496.            $ dip -t
  8497.            DIP: Dialup IP Protocol Driver version 3.3.7 (12/13/93)
  8498.            Written by Fred N. van Kempen, MicroWalt Corporation.
  8499.  
  8500.            DIP> help
  8501.            DIP knows about the following commands:
  8502.  
  8503.                    databits default  dial     echo     flush
  8504.                    get      goto     help     if       init
  8505.                    mode     modem    parity   print    port
  8506.                    reset    send     sleep    speed    stopbits
  8507.                    term     wait
  8508.  
  8509.            DIP> echo
  8510.            Usage: echo on|off
  8511.            DIP> 
  8512.  
  8513.  
  8514.  
  8515.  
  8516.            Throughout the following, examples that  display  the  DIP>  prompt
  8517.       show  how  to enter a command in test mode, and what output it produces.
  8518.       Examples lacking this prompt should be taken as script excerpts.
  8519.  
  8520.  
  8521.       8.3.2.1  The Modem Commands
  8522.       There is a number of commands dip provides to configure your serial line
  8523.       and  modem.  Some  of  these  are obvious, such as port, which selects a
  8524.       serial port, and speed, databits, stopbits, and parity,  which  set  the
  8525.       common line parameters.
  8526.  
  8527.  
  8528.            The  modem  command  selects a modem type. Currently, the only type
  8529.       supported is HAYES (capitalization required).  You have to  provide  dip
  8530.       with  a  modem  type,  else it will refuse to execute the dial and reset
  8531.       commands.  The reset command sends a reset  string  to  the  modem;  the
  8532.       string  used  depends  on  the modem type selected. For Hayes-compatible
  8533.       modems, this is ATZ.
  8534.  
  8535.  
  8536.            The flush code can be used to flush out all responses the modem has
  8537.       sent  so  far. Otherwise a chat script following the reset might be con-
  8538.       fused, because it reads the OK responses from earlier commands.
  8539.  
  8540.  
  8541.  
  8542.  
  8543.  
  8544.  
  8545.  
  8546.  
  8547.                                  - 130 -
  8548.  
  8549.  
  8550.  
  8551.            The init command selects an initialization string to be  passed  to
  8552.       the  modem before dialling. The default for Hayes modems is ``ATE0 Q0 V1
  8553.       X1'', which turns on echoing of commands  and  long  result  codes,  and
  8554.       selects blind dialing (no checking of dial tone).
  8555.  
  8556.  
  8557.            The  dial  command  finally  sends the initialization string to the
  8558.       modem and dials up the remote system. The default dial command for Hayes
  8559.       modems is ATD.
  8560.  
  8561.  
  8562.       8.3.2.2  echo and term
  8563.       The  echo command serves as a debugging aid, in that using echo on makes
  8564.       dip echo to the console everything sends to the serial device. This  can
  8565.       be turned off again by calling echo off.
  8566.  
  8567.  
  8568.            dip also allows you to leave script mode temporarily and enter ter-
  8569.       minal mode. In this mode, you can use dip just like any ordinary  termi-
  8570.       nal  program,  writing  to the serial line and reading from it. To leave
  8571.       this mode, enter `Ctrl-]'.
  8572.  
  8573.  
  8574.       8.3.2.3  The get Command
  8575.       The get command is dip's way of setting a variable.  The  simplest  form
  8576.       is  to  set a variable to a constant, as used throughout the above exam-
  8577.       ple. You may, however, also prompt the user for input by specifying  the
  8578.       keyword ask instead of a value:
  8579.  
  8580.  
  8581.  
  8582.            DIP> get $local ask
  8583.            Enter the value for $local: 
  8584.  
  8585.  
  8586.  
  8587.  
  8588.            A third method is to try to obtain the value from the remote  host.
  8589.       Bizarre  as it seems first, this is very useful in some cases: Some SLIP
  8590.       servers will not allow you to use your own IP address on the SLIP  link,
  8591.       but  will  rather  assign  you one from a pool of addresses whenever you
  8592.       dial in, printing some message that informs you about  the  address  you
  8593.       have  been  assigned.  If  the  message looks something like this ``Your
  8594.       address: 193.174.7.202'', then the following piece of dip code would let
  8595.       you pick up the address:
  8596.  
  8597.  
  8598.  
  8599.            wait address: 10
  8600.            get $locip remote
  8601.  
  8602.  
  8603.  
  8604.  
  8605.  
  8606.  
  8607.  
  8608.  
  8609.  
  8610.  
  8611.  
  8612.  
  8613.                                  - 131 -
  8614.  
  8615.  
  8616.  
  8617.       8.3.2.4  The print Command
  8618.       This  is  the  command to echo text to the console dip was started from.
  8619.       Any of dip's variables may be used in print commands, such as
  8620.  
  8621.  
  8622.  
  8623.            DIP> print Using port $port at speed $speed
  8624.            Using port cua3 at speed 38400
  8625.  
  8626.  
  8627.  
  8628.  
  8629.       8.3.2.5  Variable Names
  8630.       dip  only  understands  a  predefined  set of variables. A variable name
  8631.       always begins with a dollar symbol and must  be  written  in  lower-case
  8632.       letters.
  8633.  
  8634.  
  8635.            The  $local  and $locip variables contain the local host's name and
  8636.       IP address. Setting the hostname makes dip store the canonical  hostname
  8637.       in  $local,  at  the  same  time  assigning  $locip the corresponding IP
  8638.       address. The analogous thing happens when setting the $locip.
  8639.  
  8640.  
  8641.            The $remote and $rmtip variables do the same for the remote  host's
  8642.       name and address.  $mtu contains the MTU value for the connection.
  8643.  
  8644.  
  8645.            These  five variables are the only ones that may be assigned values
  8646.       directly using the get command. A host of other variables  can  only  be
  8647.       set  through  corresponding  commands, but may be used print statements;
  8648.       these are $modem, $port, and $speed.
  8649.  
  8650.  
  8651.            $errlvl is the variable through which you can access the result  of
  8652.       the  last command executed. An error level of 0 indicates success, while
  8653.       a non-zero value denotes an error.
  8654.  
  8655.  
  8656.       8.3.2.6  The if and goto Commands
  8657.       The if command is rather a conditional  branch  than  what  one  usually
  8658.       calls an if. Its syntax is
  8659.  
  8660.  
  8661.            if var op number goto label
  8662.  
  8663.  
  8664.  
  8665.  
  8666.       where  the  expression  must  be  a simple comparison between one of the
  8667.       variables $errlvl, $locip, and $rmtip.  The second operand  must  be  an
  8668.       integer  number; the operator op may be one of ==, !=, <, >, <=, and >=.
  8669.  
  8670.  
  8671.  
  8672.  
  8673.  
  8674.  
  8675.  
  8676.  
  8677.  
  8678.  
  8679.                                  - 132 -
  8680.  
  8681.  
  8682.  
  8683.            The goto command makes the execution of the script continue at  the
  8684.       line  following  that  bearing the label. A label must occur as the very
  8685.       first token on the line, and must be followed immediately by a colon.
  8686.  
  8687.  
  8688.       8.3.2.7  send, wait and sleep
  8689.       These commands help implement simple chat scripts in dip.  send  outputs
  8690.       its  arguments  to  the  serial line. It does not support variables, but
  8691.       understands all C-style backslash character sequences such as \n and \b.
  8692.       The  tilde  character  (~)  is  used  as  an  abbreviation  for carriage
  8693.       return/newline.
  8694.  
  8695.  
  8696.            wait takes a word as an argument, and scans all input on the serial
  8697.       line  until it recognizes this word. The word itself may not contain any
  8698.       blanks. Optionally, you may give wait a timeout value  as  second  argu-
  8699.       ment; if the expected word is not received within that many seconds, the
  8700.       command will return with an $errlvl value of one.
  8701.  
  8702.  
  8703.            The sleep statement may be used to wait for  a  certain  amount  of
  8704.       time, for instance to patiently wait for any login sequence to complete.
  8705.       Again, the interval is specified in seconds.
  8706.  
  8707.  
  8708.       8.3.2.8  mode and default
  8709.       These commands are used to flip the serial line to SLIP mode and config-
  8710.       ure the interface.
  8711.  
  8712.  
  8713.            The  mode  command  is the last command executed by dip before gong
  8714.       into daemon mode. Unless an error occurs, the command does not return.
  8715.  
  8716.  
  8717.            mode takes a protocol name as argument.  dip  currently  recognizes
  8718.       SLIP  and  CSLIP  as  valid  names.  The current version of dip does not
  8719.       understand adaptive SLIP, however.
  8720.  
  8721.  
  8722.            After enabling SLIP mode on the serial line, dip executes  ifconfig
  8723.       to  configure  the interface as a point-to-point link, and invokes route
  8724.       to set the route to the remote host.
  8725.  
  8726.  
  8727.            If, in addition, the script executes  the  default  command  before
  8728.       mode, dip will also make the default route point to the SLIP link.
  8729.  
  8730.  
  8731.       8.4  Running in Server Mode
  8732.  
  8733.  
  8734.  
  8735.  
  8736.            Setting  up your SLIP client was the hard part. Doing the opposite,
  8737.  
  8738.  
  8739.  
  8740.  
  8741.  
  8742.  
  8743.  
  8744.  
  8745.                                  - 133 -
  8746.  
  8747.  
  8748.  
  8749.       namely configuring your host to act as a SLIP server, is much easier.
  8750.  
  8751.  
  8752.            One way to do this is to to use dip in server mode,  which  can  be
  8753.       achieved  by  invoking  it  as  diplogin. Its main configuration file is
  8754.       /etc/diphosts, which associates login names with the address  this  host
  8755.       is  assigned.   Alternatively, you can also use sliplogin, a BSD-derived
  8756.       tool that features a more flexible configuration scheme  that  lets  you
  8757.       execute  shell  scripts  whenever a host connects and disconnects. It is
  8758.       currently at Beta.
  8759.  
  8760.  
  8761.             Both programs require that you set up one login account  per  SLIP
  8762.       client.  For instance, assume you provide SLIP service to Arthur Dent at
  8763.       dent.beta.com, you might create an account named dent by adding the fol-
  8764.       lowing line to your passwd file:
  8765.  
  8766.  
  8767.  
  8768.            dent:*:501:60:Arthur Dent's SLIP account:/tmp:/usr/sbin/diplogin
  8769.  
  8770.  
  8771.  
  8772.  
  8773.       Afterwards, you would set dent's password using the passwd utility.
  8774.  
  8775.  
  8776.             Now, when dent logs in, dip will start up as a  server.   To  find
  8777.       out if he is indeed permitted to use SLIP, it will look up the user name
  8778.       in /etc/diphosts. This file details the  access  rights  and  connection
  8779.       parameter  for  each  SLIP user. A sample entry for dent could look like
  8780.       this:
  8781.  
  8782.  
  8783.            dent::dent.beta.com:Arthur Dent:SLIP,296
  8784.  
  8785.  
  8786.  
  8787.  
  8788.             The first of the colon-separated fields is the name the user  must
  8789.       log  in  as.  The  second  field may contain an additional password (see
  8790.       below). The third is the hostname or IP address  of  the  calling  host.
  8791.       Next comes an informational field without any special meaning (yet). The
  8792.       last field  describes  the  connection  parameters.  This  is  a  comma-
  8793.       separated list specifying the protocol (currently one of SLIP or CSLIP),
  8794.       followed by the MTU.
  8795.  
  8796.  
  8797.            When dent logs in, diplogin extracts the information  on  him  from
  8798.       the diphosts file, and, if the second field is not empty, prompts for an
  8799.       ``external security password''. The string entered by the user  is  com-
  8800.       pared to the (unencrypted) password from diphosts. If they do not match,
  8801.       the login attempt is rejected.
  8802.  
  8803.  
  8804.  
  8805.  
  8806.  
  8807.  
  8808.  
  8809.  
  8810.  
  8811.                                  - 134 -
  8812.  
  8813.  
  8814.  
  8815.            Otherwise, diplogin proceeds by flipping the serial line  to  CSLIP
  8816.       or  SLIP  mode,  and  sets  up  the interface and route. This connection
  8817.       remains established until the user disconnects and the modem  drops  the
  8818.       line.  diplogin will then return the line to normal line discipline, and
  8819.       exit.
  8820.  
  8821.  
  8822.             diplogin requires super-user privilege.  If  you  don't  have  dip
  8823.       running  setuid  root,  you  should make diplogin a separate copy of dip
  8824.       instead of a simple link. diplogin can then safely be made setuid, with-
  8825.       out affecting the status of dip itself.
  8826.  
  8827.  
  8828.  
  8829.  
  8830.  
  8831.  
  8832.  
  8833.  
  8834.  
  8835.  
  8836.  
  8837.  
  8838.  
  8839.  
  8840.  
  8841.  
  8842.  
  8843.  
  8844.  
  8845.  
  8846.  
  8847.  
  8848.  
  8849.  
  8850.  
  8851.  
  8852.  
  8853.  
  8854.  
  8855.  
  8856.  
  8857.  
  8858.  
  8859.  
  8860.  
  8861.  
  8862.  
  8863.  
  8864.  
  8865.  
  8866.  
  8867.  
  8868.  
  8869.  
  8870.  
  8871.  
  8872.  
  8873.  
  8874.  
  8875.  
  8876.  
  8877.                                  - 135 -
  8878.  
  8879.  
  8880.  
  8881.       9.  The Point-to-Point Protocol
  8882.  
  8883.       9.1  Untangling the P's
  8884.  
  8885.  
  8886.  
  8887.  
  8888.            Just like SLIP, PPP is a protocol to send datagrams across a serial
  8889.       connection, but addresses a couple of deficiencies of  the  former.   It
  8890.       lets  the  communicating  sides negotiate options such as the IP address
  8891.       and the maximum datagram size at startup time, and provides  for  client
  8892.       authorization.   For each of these capabilities, PPP has a separate pro-
  8893.       tocol.  Below, we will briefly cover these basic building blocks of PPP.
  8894.       This  discussion  is  far  from complete; if you want to know more about
  8895.       PPP, you are urged to read its specification in RFC 1548, as well as the
  8896.       dozen or so companion RFCs.(1)
  8897.  
  8898.  
  8899.             At the very bottom of PPP is the High-Level Data Link Control Pro-
  8900.       tocol, abbreviated HDLC,(2) which  defines  the  boundaries  around  the
  8901.       individual  PPP  frames,  and provides a 16 bit checksum.  As opposed to
  8902.       the more primitive SLIP encapsulation, a PPP frame is capable of holding
  8903.       packets  from  other  protocols  than  IP,  such  as  Novell's  IPX,  or
  8904.       Appletalk. PPP achieves this by adding a protocol  field  to  the  basic
  8905.       HDLC frame that identifies the type of packet is carried by the frame.
  8906.  
  8907.  
  8908.              LCP, the Link Control Protocol, is used on top of HDLC to negoti-
  8909.       ate options pertaining to the data link, such  as  the  Maximum  Receive
  8910.       Unit  (MRU)  that  states the maximum datagram size one side of the link
  8911.       agrees to receive.
  8912.  
  8913.  
  8914.             An important step at the configuration stage  of  a  PPP  link  is
  8915.       client  authorization. Although it is not mandatory, it is really a must
  8916.       for dial-up lines.  Usually, the  called  host  (the  server)  asks  the
  8917.       client  to authorize itself by proving it knows some secret key.  If the
  8918.       caller fails to produce the correct secret,  the  connection  is  termi-
  8919.       nated.  With PPP, authorization works both ways; that is, the caller may
  8920.       also ask the server to authenticate itself.  These authentication proce-
  8921.       dures  are  totally  independent of each other.  There are two protocols
  8922.       for different types of authorization,  which  we  will  discuss  further
  8923.       below.   They  are  named  Password Authentication Protocol, or PAP, and
  8924.       Challenge Handshake Authentication Protocol, or CHAP.
  8925.  
  8926.  
  8927.             Each network protocol that is routed across the  data  link,  like
  8928.       IP, AppleTalk, etc, is configured dynamically using a corresponding Net-
  8929.       work Control Protocol (NCP).  For instance, to send IP datagrams  across
  8930.  
  8931.       
  8932.  
  8933.       1. The relevant RFCs are listed in the Annoted Bibiliography
  8934.          at the end of this book.
  8935.       2. In  fact, HDLC is a much more general protocol devised by
  8936.          the International Standards Organization (ISO).
  8937.  
  8938.  
  8939.  
  8940.  
  8941.  
  8942.  
  8943.  
  8944.                                  - 136 -
  8945.  
  8946.  
  8947.  
  8948.       the  link,  both PPPs must first negotiate which IP address each of them
  8949.       uses.  The control protocol used for this is IPCP, the Internet Protocol
  8950.       Control Protocol.
  8951.  
  8952.  
  8953.              Beside  sending  standard  IP datagrams across the link, PPP also
  8954.       supports Van Jacobson header compression of  IP  datagrams.  This  is  a
  8955.       technique  to  shrink  the  headers of TCP packets to as little as three
  8956.       bytes. It is also used in CSLIP, and is more colloquially referred to as
  8957.       VJ  header  compression.   The  use  of compression may be negotiated at
  8958.       startup time through IPCP as well.
  8959.  
  8960.  
  8961.       9.2  PPP on Linux
  8962.  
  8963.  
  8964.  
  8965.  
  8966.            On Linux, PPP functionality is split up in two parts,  a  low-level
  8967.       HDLC  driver  located in the kernel, and the user space pppd daemon that
  8968.       handles the various control protocols.  The current release of  PPP  for
  8969.       Linux  is linux-ppp-1.0.0, and contains the kernel PPP module, pppd, and
  8970.       a program named chat used to dial up the remote system.
  8971.  
  8972.  
  8973.            The PPP kernel driver was written by Michael  Callahan.   pppd  was
  8974.       derived  from  a  free  PPP  implementation for Sun and 386BSD machines,
  8975.       which was written by Drew Perkins and others, and is maintained by  Paul
  8976.       Mackerras. It was ported to Linux by Al Longyear.(3) chat was written by
  8977.       Karl Fox.(4)
  8978.  
  8979.  
  8980.             Just like SLIP, PPP is implemented by means of a special line dis-
  8981.       cipline.  To use some serial line as a PPP link, you frst establish  the
  8982.       connection  over  your modem as usual, and subsequently convert the line
  8983.       to PPP mode.  In this mode, all incoming  data  is  passed  to  the  PPP
  8984.       driver,  which  checks  the incoming HDLC frames for validity (each HDLC
  8985.       frame carries a 16 bit checksum), and unwraps and dispatches them.  Cur-
  8986.       rently, it is able to handle IP datagrams, optionally using Van Jacobson
  8987.       header compression.  As soon as Linux supports IPX, the PPP driver  will
  8988.       be extended to handle IPX packets, too.
  8989.  
  8990.  
  8991.            The  kernel driver is aided by pppd, the PPP daemon, which performs
  8992.       the entire initialization and authentication  phase  that  is  necessary
  8993.       before  actual  network  traffic  can  be  sent across the link.  pppd's
  8994.       behavior may be fine-tuned using a number of options.  As PPP is  rather
  8995.       complex,  it  is  impossible to explain all of them in a single chapter.
  8996.  
  8997.       
  8998.  
  8999.       3. Both  authors  have  said they will be very busy for some
  9000.          time to come.  If  you  have  any  questions  on  PPP  in
  9001.          general,  you'd best ask the people on the NET channel of
  9002.          the Linux activists mailing list.
  9003.       4. karl@morningstar.com.
  9004.  
  9005.  
  9006.  
  9007.  
  9008.  
  9009.  
  9010.  
  9011.                                  - 137 -
  9012.  
  9013.  
  9014.  
  9015.       This book therefore cannot cover all aspects of pppd, but only give  you
  9016.       an  introduction.  For  more  information, refer to the manual pages and
  9017.       READMEs in the pppd source distribution, which should help you sort  out
  9018.       most  questions this chapter fails to discuss.  If your problems persist
  9019.       even after reading all documentation, you should turn to  the  newsgroup
  9020.       comp.protocols.ppp  for  help,  which  is the place where you will reach
  9021.       most of the people involved in the development of pppd.
  9022.  
  9023.  
  9024.       9.3  Running pppd
  9025.  
  9026.  
  9027.  
  9028.  
  9029.            When you want to connect to the Internet through a  PPP  link,  you
  9030.       have  to  set  up  basic  networking  capabilities  such as the loopback
  9031.       device, and the resolver.  Both have been covered in the previous  chap-
  9032.       ters.   There  are  some things to be said about using DNS over a serial
  9033.       link; please refer to the SLIP chapter for a discussion of this.
  9034.  
  9035.  
  9036.            As an introductory example of how to  establish  a  PPP  connection
  9037.       with  pppd,  assume  you are at vlager again. You have already dialed up
  9038.       the PPP server, c3po, and logged into the ppp account.  c3po has already
  9039.       fired  up  its PPP driver.  After exiting the communications program you
  9040.       used for dialing, you execute the following command:
  9041.  
  9042.  
  9043.  
  9044.            # pppd /dev/cua3 38400 crtscts defaultroute
  9045.  
  9046.  
  9047.  
  9048.  
  9049.             This will flip the serial line cua3 to PPP mode and  establish  an
  9050.       IP  link  to  c3po.  The  transfer speed used on the serial port will be
  9051.       38400bps.  The crtscts option turns on hardware handshake on  the  port,
  9052.       which is an absolute must at speeds above 9600 bps.
  9053.  
  9054.  
  9055.            The first thing pppd does after starting up is to negotiate several
  9056.       link characteristics with  the  remote  end,  using  LCP.  Usually,  the
  9057.       default set of options pppd tries to negotiate will work, so we won't go
  9058.       into this here.  We will return to LCP in more detail in some later sec-
  9059.       tion.
  9060.  
  9061.  
  9062.            For  the  time  being, we also assume that c3po doesn't require any
  9063.       authentication from us, so that the  configuration  phase  is  completed
  9064.       successfully.
  9065.  
  9066.  
  9067.              pppd  will  then  negotiate the IP parameters with its peer using
  9068.       IPCP, the IP control protocol. Since we didn't specify any particular IP
  9069.  
  9070.  
  9071.  
  9072.  
  9073.  
  9074.  
  9075.  
  9076.  
  9077.                                  - 138 -
  9078.  
  9079.  
  9080.  
  9081.       address to pppd above, it will try to use the address obtained by having
  9082.       the resolver look up the local hostname.  Both will then announce  their
  9083.       address to each other.
  9084.  
  9085.  
  9086.            Usually,  there's  nothing  wrong with these defaults. Even if your
  9087.       machine is on an Ethernet, you can use the same IP address for both  the
  9088.       Ethernet  and the PPP interface.  Nevertheless, pppd allows you to use a
  9089.       different address, or even  to  ask  your  peer  to  use  some  specific
  9090.       address.  These options are discussed in a later section.
  9091.  
  9092.  
  9093.              After  going through the IPCP setup phase, pppd will prepare your
  9094.       host's networking layer to use the PPP link. It first configures the PPP
  9095.       network interface as a point-to-point link, using ppp0 for the first PPP
  9096.       link that is active, ppp1 for the second, and so on.  Next, it will  set
  9097.       up a routing table entry that points to the host at the other end of the
  9098.       link. In the example shown above, pppd will  make  the  default  network
  9099.       route point to c3po, because we gave it the defaultroute option.(5) This
  9100.       causes  all  datagrams  to hosts not on your local network to be sent to
  9101.       c3po. There are a number of different  routing  schemes  pppd  supports,
  9102.       which we will cover in detail later in this chapter.
  9103.  
  9104.  
  9105.       9.4  Using Options Files
  9106.  
  9107.  
  9108.  
  9109.  
  9110.            Before  pppd  parses  its  command line arguments, it scans several
  9111.       files for default options.  These files may contain  any  valid  command
  9112.       line  arguments,  spread  out across an arbitrary number of lines.  com-
  9113.       ments are introduced by has signs.
  9114.  
  9115.  
  9116.            The first options file is /etc/ppp/options, which is always scanned
  9117.       when  pppd  starts  up.   Using it to set some global defaults is a good
  9118.       idea, because it allows you to keep your users from doing several things
  9119.       that  may  compromise security.  For instance, to make pppd require some
  9120.       kind of authentication (either PAP or CHAP) from the peer, you would add
  9121.       the  auth  option to this file.  This option cannot be overridden by the
  9122.       user, so that it becomes impossible to establish a PPP  connection  with
  9123.       any system that is not in our authentication databases.
  9124.  
  9125.  
  9126.              The  other  option file, which is read after /etc/ppp/options, is
  9127.       .ppprc in the user's home directory. It allows each user to specify  her
  9128.       own set of default options.
  9129.  
  9130.  
  9131.            A sample /etc/ppp/options file might look like this:
  9132.  
  9133.       
  9134.  
  9135.       5. The  default  network  route is only installed if none is
  9136.          present yet.
  9137.  
  9138.  
  9139.  
  9140.  
  9141.  
  9142.  
  9143.  
  9144.                                  - 139 -
  9145.  
  9146.  
  9147.  
  9148.            # Global options for pppd running on vlager.vbrew.com
  9149.            auth                 # require authentication
  9150.            usehostname          # use local hostname for CHAP
  9151.            lock                 # use UUCP-style device locking
  9152.            domain vbrew.com     # our domain name
  9153.  
  9154.  
  9155.  
  9156.  
  9157.             The first two of these options apply to authentication and will be
  9158.       explained  below.   The  lock  keyword makes pppd comply to the standard
  9159.       UUCP method of device locking.  With this convention, each process  that
  9160.       accesses  a  serial  device,  say  /dev/cua3,  creates a lock file named
  9161.       LCK..cua3 in the UUCP spool directory to signal that the  device  is  in
  9162.       use.  This is necessary to prevent any other programs such as minicom or
  9163.       uucico to open the serial device while used by PPP.
  9164.  
  9165.  
  9166.            The reason to provide these options  in  the  global  configuration
  9167.       file is that options such as those shown above cannot be overridden, and
  9168.       so provide for a reasonable level of security. Note however,  that  some
  9169.       options  can  be  overridden  later;  one such an example is the connect
  9170.       string.
  9171.  
  9172.  
  9173.       9.5  Dialing out with chat
  9174.  
  9175.  
  9176.  
  9177.  
  9178.            One of the things that may have struck you as inconvenient  in  the
  9179.       above  example  is  that  you  had  to establish the connection manually
  9180.       before you could fire up pppd.  Unlike dip, pppd does not have  its  own
  9181.       scripting  language  for  dialing  the remote system and logging in, but
  9182.       rather relies on some external program or shell script to do this.   The
  9183.       command  to  be  executed  can be given to pppd with the connect command
  9184.       line option.  pppd will redirect the command's standard input and output
  9185.       to  the  serial line.  One useful program for this is expect, written by
  9186.       Don Libes.  It has a very  powerful  language  based  on  Tcl,  and  was
  9187.       designed exactly for this sort of application.
  9188.  
  9189.  
  9190.              The  pppd package comes along with a similar program called chat,
  9191.       which lets you specify a UUCP-style  chat  script.   Basically,  a  chat
  9192.       script  consists of an alternating sequence of strings that we expect to
  9193.       receive from the remote system, and the answers we are to send. We  will
  9194.       call  the  expect  and  send  strings,  respectively.  This is a typical
  9195.       excerpt from a chat script;
  9196.  
  9197.  
  9198.  
  9199.            ogin: b1ff ssword: s3kr3t
  9200.  
  9201.  
  9202.  
  9203.  
  9204.  
  9205.  
  9206.  
  9207.  
  9208.  
  9209.  
  9210.                                  - 140 -
  9211.  
  9212.  
  9213.  
  9214.            This tells chat to wait for the remote system  to  send  the  login
  9215.       prompt,  and  return the login name b1ff. We only wait for ogin: so that
  9216.       it doesn't matter if the login prompt starts with an uppercase or lower-
  9217.       case  l,  or  if it arrives garbled.  The following string is an expect-
  9218.       string again that makes chat wait for the password prompt, and send  our
  9219.       password in response.
  9220.  
  9221.  
  9222.            This  is  basically  all  that  chat  scripts are about. A complete
  9223.       script to dial up a PPP server would, of course, also  have  to  include
  9224.       the  appropriate modem commands. Assume your modem understands the Hayes
  9225.       command set, and the server's telephone number was 318714. The  complete
  9226.       chat invocation to establish a connection with c3po would then be
  9227.  
  9228.  
  9229.  
  9230.            $ chat -v '' ATZ OK ATDT318714 CONNECT '' ogin: ppp word: GaGariN
  9231.  
  9232.  
  9233.  
  9234.  
  9235.            By definition, the first string must be an expect  string,  but  as
  9236.       the modem won't say anything before we have kicked it, we make chat skip
  9237.       the first expect by specifying an empty string.  We go on and send  ATZ,
  9238.       the reset command for Hayes-compatible modems, and wait for its response
  9239.       (OK). The next string sends the dial command along with the phone number
  9240.       to  chat, and expects the CONNECT message in response.  This is followed
  9241.       by an empty string again, because we don't want to  send  anything  now,
  9242.       but  rather  wait for the login prompt. The remainder of the chat script
  9243.       works exactly as described above.
  9244.  
  9245.  
  9246.            The -v option makes chat log all activities to the syslog  daemon's
  9247.       local2 facility.(6)
  9248.  
  9249.  
  9250.             Specifying the chat script on the command  line  bears  a  certain
  9251.       risk,  because  users  can view a process' command line with the ps com-
  9252.       mand.  You can avoid this by putting the chat  script  in  a  file,  say
  9253.       dial-c3po.   You  make chat read the script from the file instead of the
  9254.       command line by giving it the -f option, followed by the file name.  The
  9255.       complete pppd incantation would now look like this:
  9256.  
  9257.  
  9258.  
  9259.            # pppd connect "chat -f dial-c3po" /dev/cua3 38400 -detach \
  9260.                    crtscts modem defaultroute
  9261.  
  9262.  
  9263.  
  9264.       
  9265.  
  9266.       6. If you edit syslog.conf to redirect these log messages to
  9267.          a file, make sure this file isn't world readable, as chat
  9268.          also  logs the entire chat script by default -- including
  9269.          passwords and all.
  9270.  
  9271.  
  9272.  
  9273.  
  9274.  
  9275.  
  9276.  
  9277.                                  - 141 -
  9278.  
  9279.  
  9280.  
  9281.            Beside the connect option that specifies  the  dial-up  script,  we
  9282.       have  added  two  more options to the command line: -detach, which tells
  9283.       pppd not to detach from the console and become a background process. The
  9284.       modem keyword makes it perform some modem-specific actions on the serial
  9285.       device, like hanging up the line before and after the call. If you don't
  9286.       use  this  keyword,  pppd will not monitor the port's DCD line, and will
  9287.       therefore not detect if the remote end hangs up unexpectedly.
  9288.  
  9289.  
  9290.            The examples shown above were rather simple; chat allows  for  much
  9291.       more  complex  chat  scripts.  One very useful feature is the ability to
  9292.       specify strings on which to abort the chat with an error.  Typical abort
  9293.       strings  are  messages like BUSY, or NO CARRIER, that your modem usually
  9294.       generates when the called number is busy, or doesn't pick up the  phone.
  9295.       To  make  chat  recognize these immediately, rather than timing out, you
  9296.       can specify them at the beginning of the script using the ABORT keyword:
  9297.  
  9298.  
  9299.  
  9300.            $ chat -v ABORT BUSY ABORT 'NO CARRIER' '' ATZ OK ...
  9301.  
  9302.  
  9303.  
  9304.  
  9305.            In a similar fashion, you may change the timeout value for parts of
  9306.       the chat scripts by inserting TIMEOUT options. For details, please check
  9307.       the chat(8) manual page.
  9308.  
  9309.  
  9310.            Sometimes, you'd also want to have some sort of conditional  execu-
  9311.       tion  of  parts of the chat script. For instance, when you don't receive
  9312.       the remote end's login prompt, you might want to send a BREAK, or a car-
  9313.       riage  return.  You  can  achieve  this  by appending a sub-script to an
  9314.       expect string.  It consists of a sequence of send-  and  expect-strings,
  9315.       just like the overall script itself, which are separated by hyphens. The
  9316.       sub-script is executed whenever the expected string they are appended to
  9317.       is not received in time.  In the example above, we would modify the chat
  9318.       script as follows:
  9319.  
  9320.  
  9321.  
  9322.            ogin:-BREAK-ogin: ppp ssword: GaGariN
  9323.  
  9324.  
  9325.  
  9326.  
  9327.            Now, when chat doesn't see the remote system send the login prompt,
  9328.       the  sub-script  is  executed by first sending a BREAK, and then waiting
  9329.       for the login prompt again. If the prompt now appears, the  script  con-
  9330.       tinues as usual, otherwise it will terminate with an error.
  9331.  
  9332.  
  9333.  
  9334.  
  9335.  
  9336.  
  9337.  
  9338.  
  9339.  
  9340.  
  9341.  
  9342.  
  9343.                                  - 142 -
  9344.  
  9345.  
  9346.  
  9347.       9.6  Debugging Your PPP Setup
  9348.  
  9349.  
  9350.  
  9351.  
  9352.            By  default,  pppd will log any warnings and error messages to sys-
  9353.       log's daemon facility.  You have to add an  entry  to  syslog.conf  that
  9354.       redirects  this  to a file, or even the console, otherwise syslog simply
  9355.       discards these messages. The  following  entry  sends  all  messages  to
  9356.       /var/log/ppp-log:
  9357.  
  9358.  
  9359.  
  9360.            daemon.*                /var/log/ppp-log
  9361.  
  9362.  
  9363.  
  9364.  
  9365.            If  your PPP setup doesn't work at once, looking into this log file
  9366.       should give you a first hint of what goes wrong. If this  doesn't  help,
  9367.       you can also turn on extra debugging output using the debug option. This
  9368.       makes pppd log the contents of all control packets sent or  received  to
  9369.       syslog.  All messages will go to the daemon facility.
  9370.  
  9371.  
  9372.            Finally,  the most drastic feature is to enable kernel-level debug-
  9373.       ging by invoking pppd with the kdebug  option.   It  is  followed  by  a
  9374.       numeric  argument  that is the bitwise OR of the following values: 1 for
  9375.       general debug messages, 2 for printing the contents of all incoming HDLC
  9376.       frames, and 4 to make the driver print all outgoing HDLC frames. To cap-
  9377.       ture kernel debugging messages, you must either  run  a  syslogd  daemon
  9378.       that  reads  the  /proc/kmsg  file,  or the klogd daemon. Either of them
  9379.       directs kernel debugging to syslog's kernel facility.
  9380.  
  9381.  
  9382.       9.7  IP Configuration Options
  9383.  
  9384.  
  9385.  
  9386.  
  9387.            IPCP is used to negotiate a couple of IP parameters at link config-
  9388.       uration time.  Usually, each peer may send an IPCP Configuration Request
  9389.       packet, indicating which values it wants to change  from  the  defaults,
  9390.       and  to what value. Upon receipt, the remote end inspects each option in
  9391.       turn, and either acknowledges or rejects it.
  9392.  
  9393.  
  9394.            pppd gives you a lot of control about which IPCP  options  it  will
  9395.       try  to  negotiate.   You  can  tune  this  through various command line
  9396.       options we will discuss below.
  9397.  
  9398.  
  9399.  
  9400.  
  9401.  
  9402.  
  9403.  
  9404.  
  9405.  
  9406.  
  9407.  
  9408.  
  9409.                                  - 143 -
  9410.  
  9411.  
  9412.  
  9413.       9.7.1  Choosing IP Addresses
  9414.  
  9415.  
  9416.  
  9417.  
  9418.            In the example above, we had pppd dial up c3po and establish an  IP
  9419.       link.   No  provisions  were  taken to choose a particular IP address on
  9420.       either end of the link.  Instead, we  picked  vlager's  address  as  the
  9421.       local  IP address, and let c3po provide its own.  Sometimes, however, it
  9422.       is useful to have control over what address is used on one or the  other
  9423.       end of the link.  pppd supports several variations of this.
  9424.  
  9425.  
  9426.            To  ask  for  particular addresses, you generally provide pppd with
  9427.       the following option:
  9428.  
  9429.  
  9430.            local addr:remote addr
  9431.  
  9432.  
  9433.  
  9434.  
  9435.       where local addr and remote addr may be specified either in dotted  quad
  9436.       notation,  or  as hostnames.(7) This makes pppd attempt to use the first
  9437.       address as its own IP address, and the second as the peer's. If the peer
  9438.       rejects  either  of  them  during  IPCP  negotiation, no IP link will be
  9439.       established.(8)
  9440.  
  9441.  
  9442.            If  you  want to set only the local address, but accept any address
  9443.       the peer uses, you simply leave out the remote addr part. For  instance,
  9444.       to  make  vlager  use the IP address 130.83.4.27 instead of its own, you
  9445.       would give it 130.83.4.27: on the command line.  Similarly, to  set  the
  9446.       remote  address  only,  you  would  leave the local addr field blank. By
  9447.       default, pppd will then use the address associated with your hostname.
  9448.  
  9449.  
  9450.             Some PPP  servers  that  handle  a  lot  of  client  sites  assign
  9451.       addresses dynamically: addresses are assigned to systems only when call-
  9452.       ing in, and are claimed after they have logged off again.  When  dialing
  9453.       up  such a server, you must make sure that pppd doesn't request any par-
  9454.       ticular IP address from the server, but rather accept  the  address  the
  9455.       server asks you to use. This means that you mustn't specify a local addr
  9456.       argument. In addition, you have to use  the  noipdefault  option,  which
  9457.       makes  pppd wait for the peer to provide the IP address instead of using
  9458.       the local host's address.
  9459.  
  9460.       
  9461.  
  9462.       7. Using  hostnames  in this option has consequences on CHAP
  9463.          authentication. Please  refer  to  the  section  on  CHAP
  9464.          below.
  9465.       8. You can allow the peer PPP to override your ideas  of  IP
  9466.          addresses  by giving pppd the ipcp-accept-local and ipcp-
  9467.          accept-remote options. Please refer to  the  manual  page
  9468.          for details.
  9469.  
  9470.  
  9471.  
  9472.  
  9473.  
  9474.  
  9475.  
  9476.                                  - 144 -
  9477.  
  9478.  
  9479.  
  9480.  
  9481.  
  9482.  
  9483.       9.7.2  Routing Through a PPP Link
  9484.  
  9485.  
  9486.  
  9487.  
  9488.            After setting up the network interface, pppd will usually set up  a
  9489.       host  route  to  its peer only. If the remote host is on a LAN, you cer-
  9490.       tainly want to be able to connect to hosts ``behind'' your peer as well;
  9491.       that is, a network route must be set up.
  9492.  
  9493.  
  9494.            We  have  already  seen  above  that  pppd  can be asked to set the
  9495.       default route using the defaultroute option.  This option is very useful
  9496.       if the PPP server you dialed up will act as your Internet gateway.
  9497.  
  9498.  
  9499.             The reverse case, where your system acts as a gateway for a single
  9500.       host, is also relatively easy to accomplish.   For  example,  take  some
  9501.       employee  at  the  Virtual  Brewery  whose home machine is called loner.
  9502.       When connecting to vlager through PPP, he uses an address on  the  Brew-
  9503.       ery's  subnet.   At  vlager,  we  can now give pppd the proxyarp option,
  9504.       which will install a proxy ARP entry for loner.  This will automatically
  9505.       make loner accessible from all hosts at the Brewery and the Winery.
  9506.  
  9507.  
  9508.              However,  things aren't always as easy as that, for instance when
  9509.       linking two local area networks.  This usually requires  adding  a  spe-
  9510.       cific  network  route, because these networks may have their own default
  9511.       routes.  Besides, having both peers use the  PPP  link  as  the  default
  9512.       route would generate a loop, where packets to unknown destinations would
  9513.       ping-pong between the peers until their time-to-live expired.
  9514.  
  9515.  
  9516.            As an example, suppose the Virtual Brewery opens a branch  in  some
  9517.       other  city.  The  subsidiary runs an Ethernet of their own using the IP
  9518.       network number 191.72.3.0, which is subnet 3 of the  Brewery's  class  B
  9519.       network.  They want to connect to the Brewery's main Ethernet via PPP to
  9520.       update customer databases, etc.  Again, vlager acts as the gateway;  its
  9521.       peer is called sub-etha and has an IP address of 191.72.3.1..
  9522.  
  9523.  
  9524.            When  sub-etha  connects  to vlager, it will make the default route
  9525.       point to vlager as usual. On vlager, however, we will have to install  a
  9526.       network route for subnet 3 that goes through sub-etha.  For this, we use
  9527.       a feature of pppd not discussed so far -- the ip-up command.  This is  a
  9528.       shell  script  or program located in /etc/ppp that is executed after the
  9529.       PPP interface has been configured. When present, it is invoked with  the
  9530.       following parameters:
  9531.  
  9532.  
  9533.  
  9534.  
  9535.  
  9536.  
  9537.  
  9538.  
  9539.  
  9540.  
  9541.  
  9542.                                  - 145 -
  9543.  
  9544.  
  9545.  
  9546.            ip-up iface device speed local addr remote addr
  9547.  
  9548.  
  9549.  
  9550.  
  9551.       where  iface names the network interface used, device is the pathname of
  9552.       the serial device file used (/dev/tty if  stdin/stdout  are  used),  and
  9553.       speed  is  the  device's  speed.  local addr and remote addr give the IP
  9554.       addresses used at both ends of the link in dotted quad notation. In  our
  9555.       case, the ip-up script may contain the following code fragment:
  9556.  
  9557.  
  9558.  
  9559.            #!/bin/sh
  9560.            case $5 in
  9561.            191.72.3.1)            # this is sub-etha
  9562.                    route add -net 191.72.3.0 gw 191.72.3.1;;
  9563.            esac
  9564.            exit 0
  9565.  
  9566.  
  9567.  
  9568.  
  9569.            In  a similar fashion, /etc/ppp/ip-down is used to undo all actions
  9570.       of ip-up after the PPP link has been taken down again.
  9571.  
  9572.  
  9573.             However, the routing scheme is not yet complete.  We have  set  up
  9574.       routing  table entries on both PPP hosts, but so far, all other hosts on
  9575.       both networks don't know anything about the PPP link.  This is not a big
  9576.       problem if all hosts at the subsidiary have their default route pointing
  9577.       at sub-etha, and all Brewery hosts route to vlager by default.  If  this
  9578.       is  not the case, your only option will usually be to use a routing dae-
  9579.       mon like gated.  After creating the network route on vlager, the routing
  9580.       daemon  would  broadcast the new route to all hosts on the attached sub-
  9581.       nets.
  9582.  
  9583.  
  9584.  
  9585.  
  9586.  
  9587.       9.8  Link Control Options
  9588.  
  9589.  
  9590.  
  9591.  
  9592.            Above, we already encountered LCP, the Link Control Protocol, which
  9593.       is used to negotiate link characteristics, and to test the link.
  9594.  
  9595.  
  9596.            The  two  most  important options that may be negotiated by LCP are
  9597.       the maximum receive unit, and the Asynchronous  Control  Character  Map.
  9598.       There  are a number of other LCP configuration options, but they are far
  9599.       too specialized to  discuss  here.  Please  refer  to  RFC  1548  for  a
  9600.  
  9601.  
  9602.  
  9603.  
  9604.  
  9605.  
  9606.  
  9607.  
  9608.                                  - 146 -
  9609.  
  9610.  
  9611.  
  9612.       description of those.
  9613.  
  9614.  
  9615.              The  Asynchronous  Control Character Map, colloquially called the
  9616.       async map, is used on asynchronous links  such  as  telephone  lines  to
  9617.       identify control characters that must be escaped (replaced by a specific
  9618.       two-character sequence). For instance, you may want to avoid the XON and
  9619.       XOFF  characters used for software handshake, because some misconfigured
  9620.       modem might choke upon receipt of an  XOFF.   Other  candidates  include
  9621.       Ctrl-]  (the  telnet escape character).  PPP allows you to escape any of
  9622.       the characters with ASCII codes 0 through 31 by specifying them  in  the
  9623.       async map.
  9624.  
  9625.  
  9626.            The  async map is a bitmap 32 bits wide, with the least significant
  9627.       bit corresponding to the ASCII NUL character, and the  most  significant
  9628.       bit corrsponding to ASCII 31.  If a bit is set, it signals that the cor-
  9629.       responding character must be escaped before sending it across the  link.
  9630.       Initially,  the  async  map  is  set to 0xffffffff, that is, all control
  9631.       characters will be esaped.
  9632.  
  9633.  
  9634.            To tell your peer that it doesn't have to escape all control  char-
  9635.       acters  but  only  a few of them, you can specify a new asyncmap to pppd
  9636.       using the asyncmap option. For instance, if only ^S and ^Q (ASCII 17 and
  9637.       19,  commonly  used for XON and XOFF) must be escaped, use the following
  9638.       option:
  9639.  
  9640.  
  9641.            asyncmap 0x000A0000
  9642.  
  9643.  
  9644.  
  9645.  
  9646.             The Maximum Receive Unit, or MRU, signals to the peer the  maximum
  9647.       size of HDLC frames we want to receive.  Although this may remind you of
  9648.       the MTU value (Maximum Transfer Unit), these two have little in  common.
  9649.       The  MTU  is  a parameter of the kernel networking device, and describes
  9650.       the maximum frame size the interface is able to handle. The MRU is  more
  9651.       of  an  advice  to the remote end not to generate any frames larger than
  9652.       the MRU; the interface must nevertheless be able to receive frames of up
  9653.       to 1500 bytes.
  9654.  
  9655.  
  9656.              Choosing  an  MRU is therefore not so much a question of what the
  9657.       link is capable of transferring, but of what gives you the best through-
  9658.       put.   If you intend to run interactive applications over the link, set-
  9659.       ting the MRU to values as low as 296 is a good idea, so  that  an  occa-
  9660.       sional larger packet (say, from an FTP session) doesn't make your cursor
  9661.       ``jump''.  To tell pppd to request an MRU of 296, you would give it  the
  9662.       option  mru 296.  Small MRUs, however, only make sense if you don't have
  9663.       VJ header compression disabled (it is enabled by default).
  9664.  
  9665.  
  9666.  
  9667.  
  9668.  
  9669.  
  9670.  
  9671.  
  9672.  
  9673.  
  9674.                                  - 147 -
  9675.  
  9676.  
  9677.  
  9678.            pppd understands also a couple of LCP options  that  configure  the
  9679.       overall  behavior of the negotiation process, such as the maximum number
  9680.       of configuration requests that may be exchanged before the link is  ter-
  9681.       minated.   Unless  you  kow exactly what you are doing, you should leave
  9682.       these alone.
  9683.  
  9684.  
  9685.            Finally, there are two options that apply to LCP echo messages. PPP
  9686.       defines  two  messages,  Echo  Request and Echo Response. pppd uses this
  9687.       feature to check if a link is still operating.  You can enable  this  by
  9688.       using  the lcp-echo-interval option together with a time in seconds.  If
  9689.       no frames are received from the remote host within this  interval,  pppd
  9690.       generates  an  Echo  Request,  and  expects  the  peer to return an Echo
  9691.       Response.  If the peer does not produce a response, the link  is  termi-
  9692.       nated  after  a certain number of requests sent.  This number can be set
  9693.       using the lcp-echo-failure option.  By default, this feature is disabled
  9694.       altogether.
  9695.  
  9696.  
  9697.  
  9698.  
  9699.  
  9700.       9.9  General Security Considerations
  9701.  
  9702.  
  9703.  
  9704.  
  9705.            A  misconfigured  PPP  daemon can be a devastating security breach.
  9706.       It can be as bad as letting anyone plug in their machine into your  Eth-
  9707.       ernet  (and  that  is  very bad). In this section, we will discuss a few
  9708.       measures that should make your PPP configuration safe.
  9709.  
  9710.  
  9711.            One problem with pppd is that to configure the network  device  and
  9712.       the  routing  table, it requires root privilege.  You will usually solve
  9713.       this by running it setuid root. However, pppd allows users to set  vari-
  9714.       ous  security-relevant  options.   To protect against any attacks a user
  9715.       may launch by manipulating these options, it is suggested you set a cou-
  9716.       ple  of  default  values in the global /etc/ppp/options file, like those
  9717.       shown in the sample file in section 9.4.  Some  of  them,  such  as  the
  9718.       authentication options, cannot be overridden by the user, and so provide
  9719.       a reasonable protection against manipulations.
  9720.  
  9721.  
  9722.            Of course, you have to protect yourself from the systems you  speak
  9723.       PPP  with,  too.   To  fend off hosts posing as someone else, you should
  9724.       always some sort of authentication from your  peer.   Additionally,  you
  9725.       should  not  allow  foreign hosts to use any IP address they choose, but
  9726.       restrict them to at least a few.  The following section will  deal  with
  9727.       these topics.
  9728.  
  9729.  
  9730.  
  9731.  
  9732.  
  9733.  
  9734.  
  9735.  
  9736.  
  9737.  
  9738.  
  9739.  
  9740.                                  - 148 -
  9741.  
  9742.  
  9743.  
  9744.       9.10  Authentication with PPP
  9745.  
  9746.  
  9747.  
  9748.  
  9749.       9.10.1  CHAP versus PAP
  9750.  
  9751.  
  9752.  
  9753.  
  9754.            With  PPP,  each system may require its peer to authenticate itself
  9755.       using one of two  authentication  protocols.   These  are  the  Password
  9756.       Authentication  Protocol  (PAP), and the Challenge Handshake Authentica-
  9757.       tion Protocol (CHAP).  When a connection is established,  each  end  can
  9758.       request  the  other  to authenticate itself, regardless of whether it is
  9759.       the caller or the callee.  Below I will loosely  talk  of  `client'  and
  9760.       `server'  when  I  want to distinguish between the authenticating system
  9761.       and the authenticator.  A PPP daemon can ask its peer for authentication
  9762.       by sending yet another LCP configuration request identifying the desired
  9763.       authentication protocol.
  9764.  
  9765.  
  9766.            PAP works basically the same way as the normal login procedure. The
  9767.       client  authenticates  itself  by sending a user name and an (optionally
  9768.       encrypted) password to the server, which  the  server  compares  to  its
  9769.       secrets database.  This technique is vulnerable to eavesdroppers who may
  9770.       try to obtain the password by listening in on the serial  line,  and  to
  9771.       repeated trial and error attacks.
  9772.  
  9773.  
  9774.            CHAP does not have these deficiencies. With CHAP, the authenticator
  9775.       (i.e. the server) sends a randomly generated ``challenge'' string to the
  9776.       client, along with its hostname. The client uses the hostname to look up
  9777.       the appropriate secret, combines it with the challenge, and encrypts the
  9778.       string  using a one-way hashing function.  The result is returned to the
  9779.       server along with the client's hostname. The  server  now  performs  the
  9780.       same  computation, and acknowledges the client if it arrives at the same
  9781.       result.
  9782.  
  9783.  
  9784.            Another feature of CHAP is that it doesn't only require the  client
  9785.       to  authenticate itself at startup time, but sends challenges at regular
  9786.       intervals to make sure the client hasn't been replaced by  an  intruder,
  9787.       for instance by just switching phone lines.
  9788.  
  9789.  
  9790.            pppd  keeps the secret keys for CHAP and PAP in two separate files,
  9791.       called /etc/ppp/chap-secrets and pap-secrets, respectively.  By entering
  9792.       a  remote  host  in  one or the other file, you have a fine control over
  9793.       whether CHAP or PAP is used to authenticate ourselves with our peer, and
  9794.       vice versa.
  9795.  
  9796.  
  9797.            By  default,  pppd  doesn't require authentication from the remote,
  9798.  
  9799.  
  9800.  
  9801.  
  9802.  
  9803.  
  9804.  
  9805.  
  9806.                                  - 149 -
  9807.  
  9808.  
  9809.  
  9810.       but will agree to authenticate itself when requested by the remote.   As
  9811.       CHAP is so much stronger than PAP, pppd tries to use the former whenever
  9812.       possible.  If the peer does not support it, or if pppd can't find a CHAP
  9813.       secret  for  the  remote  system in its chap-secrets file, it reverts to
  9814.       PAP. If it doesn't have a PAP secret for its peer either, it will refuse
  9815.       to  authenticate altogether.  As a consequence, the connection is closed
  9816.       down.
  9817.  
  9818.  
  9819.            This behavior can be modified in several ways. For  instance,  when
  9820.       given  the  auth  keyword,  pppd  will  require the peer to authenticate
  9821.       itself. pppd will agree to use either CHAP or PAP for this, as  long  as
  9822.       it  has a secret for the peer in its CHAP or PAP database, respectively.
  9823.       There are other options to turn a particular authentication protocol  on
  9824.       or  off,  but  I  won't describe them here.  Please refer to the pppd(8)
  9825.       manual page for details.
  9826.  
  9827.  
  9828.            If all systems you talk PPP with agree to  authenticate  themselves
  9829.       with  you, you should put the auth option in the global /etc/ppp/options
  9830.       file and define passwords for each system in the chap-secrets file. If a
  9831.       system  doesn't  support  CHAP,  add  an entry for it to the pap-secrets
  9832.       file. In this way, you can make sure no unauthenticated system  connects
  9833.       to your host.
  9834.  
  9835.  
  9836.            The  next  two  sections  discuss  the  two PPP secrets files, pap-
  9837.       secrets and chap-secrets. They  are  located  in  /etc/ppp  and  contain
  9838.       triples of clients, servers and passwords, optionally followed by a list
  9839.       of IP addresses.  The interpretation of the client and server fields  is
  9840.       different  for CHAP and PAP, and also depends on whether we authenticate
  9841.       ourselves with the peer, or whether we require the server  to  authenti-
  9842.       cate itself with us.
  9843.  
  9844.  
  9845.       9.10.2  The CHAP Secrets File
  9846.  
  9847.  
  9848.  
  9849.  
  9850.            When  it  has  to  authenticate itself with some server using CHAP,
  9851.       pppd searches the pap-secrets file for an entry with  the  client  field
  9852.       equal  to  the  local hostname, and the server field equal to the remote
  9853.       hostname sent in the CHAP Challenge.  When requiring the peer to authen-
  9854.       ticate itself, the roles are simply reversed: pppd will then look for an
  9855.       entry with the client field equal to the remote hostname  (sent  in  the
  9856.       client's  CHAP  Response), and the server field equal to the local host-
  9857.       name.
  9858.  
  9859.  
  9860.            The following is a sample chap-secrets file for vlager:(9)
  9861.  
  9862.  
  9863.  
  9864.  
  9865.  
  9866.  
  9867.  
  9868.  
  9869.  
  9870.  
  9871.  
  9872.                                  - 150 -
  9873.  
  9874.  
  9875.  
  9876.            # CHAP secrets for vlager.vbrew.com
  9877.            #
  9878.            # client          server            secret                addrs
  9879.            #----------------------------------------------------------------------
  9880.            vlager.vbrew.com  c3po.lucas.com    "Use The Source Luke" vlager.vbrew.com
  9881.            c3po.lucas.com    vlager.vbrew.com  "riverrun, pasteve"   c3po.lucas.com
  9882.            *                 vlager.vbrew.com  "VeryStupidPassword"  pub.vbrew.com
  9883.  
  9884.  
  9885.  
  9886.  
  9887.            When establishing a PPP connection with c3po, c3po asks  vlager  to
  9888.       authenticate  itself  using  CHAP by sending a CHAP challenge. pppd then
  9889.       scans  chap-secrets  for  an  entry  with  the  client  field  equal  to
  9890.       vlager.vbrew.com  and  the server field equal to c3po.lucas.com,(10) and
  9891.       finds the first line shown above. It then  produces  the  CHAP  Response
  9892.       from  the  challenge  string  and  the secret (Use The Source Luke), and
  9893.       sends it off to c3po.
  9894.  
  9895.  
  9896.            At the same time, pppd composes a CHAP challenge for c3po, contain-
  9897.       ing  a  unique  challenge  string,  and  its  fully  qualified  hostname
  9898.       vlager.vbrew.com. c3po constructs a CHAP Response in the manner we  just
  9899.       discussed,  and returns it to vlager. pppd now extracts the client host-
  9900.       name (c3po.vbrew.com) from the Response, and searches  the  chap-secrets
  9901.       file for a line matching c3po as a client, and vlager as the server. The
  9902.       second line does this, so pppd  combines  the  CHAP  challenge  and  the
  9903.       secret  riverrun,  pasteve,  encrypts  them,  and compares the result to
  9904.       c3po's CHAP respnose.
  9905.  
  9906.  
  9907.             The optional fourth field lists the IP addresses that are  accept-
  9908.       able  for  the  clients  named  in the first field. The addresses may be
  9909.       given in dotted quad notation or as hostnames that are  looked  up  with
  9910.       the  resolver.  For instance, if c3po requests to use an IP address dur-
  9911.       ing IPCP negotiation that is not in  this  list,  the  request  will  be
  9912.       rejected,  and  IPCP will be shut down.  In the sample file shown above,
  9913.       c3po is therefore limited to using its own IP address.  If  the  address
  9914.       field is empty, any addresses will be allowed; a value of - prevents the
  9915.       use of IP with that client altogether.
  9916.  
  9917.  
  9918.            The third line of the sample chap-secrets file allows any  host  to
  9919.       establish  a  PPP link with vlager because a client or server field of *
  9920.       matches any hostname.  The only requirement is that it knows the secret,
  9921.       and  uses the address of pub.vbrew.com.  Entries with wildcard hostnames
  9922.       may appear anywhere in the secrets file, since pppd will always use  the
  9923.       most specific entry that applies to a server/client pair.
  9924.  
  9925.       
  9926.  
  9927.       9. The double quotes are not  part  of  the  password,  they
  9928.          merely  serve  to  protect  the  white  space  within the
  9929.          password.
  9930.       10.This hostname is taken from the CHAP challenge.
  9931.  
  9932.  
  9933.  
  9934.  
  9935.  
  9936.  
  9937.  
  9938.                                  - 151 -
  9939.  
  9940.  
  9941.  
  9942.            There  are  some words to be said about the way pppd arrives at the
  9943.       hostnames it looks up in the secrets  file.  As  explained  before,  the
  9944.       remote  hostname is always provided by the peer in the CHAP Challenge or
  9945.       Response packet.  The local hostname will  be  derived  by  calling  the
  9946.       gethostname(2)  function  by default. If you have set the system name to
  9947.       your unqualified hostname, such you have to provide pppd with the domain
  9948.       name in addition using the domain option:
  9949.  
  9950.  
  9951.            # pppd ...domain vbrew.com
  9952.  
  9953.  
  9954.  
  9955.  
  9956.            This  will  append  the  Brewery's  domain  name  to vlager for all
  9957.       authentication-related activities.  Other options that modify progpppd's
  9958.       idea  of the local hostname are usehostname and name.  When you give the
  9959.       local IP address on the  command  line  using  ``local:varremote'',  and
  9960.       local  is  a  name  instead  of a dotted quad, pppd will use this as the
  9961.       local hostname. For details, please refer to the pppd(8) manual page.
  9962.  
  9963.  
  9964.  
  9965.  
  9966.  
  9967.       9.10.3  The PAP Secrets File
  9968.  
  9969.  
  9970.  
  9971.  
  9972.            The PAP secrets file is very similar to  that  used  by  CHAP.  The
  9973.       first two fields always contain a user name and a server name; the third
  9974.       holds the PAP secret.  When the remote sends  an  authenticate  request,
  9975.       pppd uses the entry that has a server field equal to the local hostname,
  9976.       and a user field equal to the user  name  sent  in  the  request.   When
  9977.       authenticating  itself  with  the peer, pppd picks the secret to be sent
  9978.       from the line with the user field equal to the local user name, and  the
  9979.       server field equal to the remote hostname.
  9980.  
  9981.  
  9982.            A sample PAP secrets file might look like this:
  9983.  
  9984.  
  9985.  
  9986.            # /etc/ppp/pap-secrets
  9987.            #
  9988.            # user          server          secret          addrs
  9989.            vlager-pap      c3po            cresspahl       vlager.vbrew.com
  9990.            c3po            vlager          DonaldGNUth     c3po.lucas.com
  9991.  
  9992.  
  9993.  
  9994.  
  9995.            The  first  line  is used to authenticate ourselves when talking to
  9996.  
  9997.  
  9998.  
  9999.  
  10000.  
  10001.  
  10002.  
  10003.  
  10004.                                  - 152 -
  10005.  
  10006.  
  10007.  
  10008.       c3po.  The second line describes how a user named c3po has to  authenti-
  10009.       cate itself with us.
  10010.  
  10011.  
  10012.            The name vlager-pap in column one is the user name we send to c3po.
  10013.       By default, pppd will pick the local hostname as the user name, but  you
  10014.       can also specify a different name by giving the user option, followed by
  10015.       that name.
  10016.  
  10017.  
  10018.            When picking an entry from the pap-secrets file for  authentication
  10019.       with  the  peer,  pppd has to know the remote host's name.  As it has no
  10020.       way of finding that out, you have to specify  it  on  the  command  line
  10021.       using  the  remotename  keyword,  followed  by  the peer's hostname. For
  10022.       instance, to use the above entry for authentication with c3po,  we  have
  10023.       to add the following option to pppd's command line:
  10024.  
  10025.  
  10026.  
  10027.             \#{} pppd ... remotename c3po user vlager-pap
  10028.  
  10029.  
  10030.  
  10031.  
  10032.            In  the  fourth  field  (and all fields following), you may specify
  10033.       what IP addresses are allowed for that particular host, just as  in  the
  10034.       CHAP  secrets  file.  The peer may then only request addresses from that
  10035.       list.  In the sample file, we require c3po to use its real IP address.
  10036.  
  10037.  
  10038.            Note that PAP is a rather weak authentication  method,  and  it  is
  10039.       suggested  you use CHAP instead whenever possible. We will therefore not
  10040.       cover PAP in greater detail here;  if you are interested in  using  PAP,
  10041.       you will find some more PAP features in the pppd(8) manual page.
  10042.  
  10043.  
  10044.  
  10045.  
  10046.  
  10047.  
  10048.  
  10049.  
  10050.       9.11  Configuring a PPP Server
  10051.  
  10052.  
  10053.  
  10054.  
  10055.            Running pppd as a server is just a matter of adding the appropriate
  10056.       options to the command  line.   Ideally,  you  would  create  a  special
  10057.       account,  say  ppp,  and give it a script or program as login shell that
  10058.       invokes pppd with these options. For instance, you would add the follow-
  10059.       ing line to /etc/passwd:
  10060.  
  10061.  
  10062.  
  10063.  
  10064.  
  10065.  
  10066.  
  10067.  
  10068.  
  10069.  
  10070.                                  - 153 -
  10071.  
  10072.  
  10073.  
  10074.            ppp:*:500:200:Public PPP Account:/tmp:/etc/ppp/ppplogin
  10075.  
  10076.  
  10077.  
  10078.  
  10079.            Of course, you may want to use different uids and gids  than  those
  10080.       shown  above.  You  would  also  have  to set the password for the above
  10081.       account using the passwd command.
  10082.  
  10083.  
  10084.            The ppplogin script might then look like this:
  10085.  
  10086.  
  10087.  
  10088.            #!/bin/sh
  10089.            # ppplogin - script to fire up pppd on login
  10090.            mesg n
  10091.            stty -echo
  10092.            exec pppd -detach silent modem crtscts
  10093.  
  10094.  
  10095.  
  10096.  
  10097.            The mesg command disables other users to write to  the  tty  using,
  10098.       for  instance,  the  write command. The stty command turns off character
  10099.       echoing. The is necessary, because otherwise everything the  peer  sends
  10100.       would  be echoed back to it.  The most important pppd option given above
  10101.       is -detach, because it prevents pppd drom detaching from the controlling
  10102.       tty.   If  we didn't specify this option, it would go to the background,
  10103.       making the shell script exit. This would in turn would cause the  serial
  10104.       line  to be hung up and the connection to be dropped.  The silent option
  10105.       causes pppd to wait until it receives a packet from the  calling  system
  10106.       before  it starts sending. This prevents transmit timeouts to occur when
  10107.       the calling system is slow in firing up its PPP client.  The modem makes
  10108.       pppd  watch  the DTR line to see if the peer has dropped the connection,
  10109.       and crtscts turns on hardware handshake.
  10110.  
  10111.  
  10112.            Beside these options, you might want to force some sort of  authen-
  10113.       tication,  for  example by specifying auth on pppd's command line, or in
  10114.       the global options file.  The manual page also discusses  more  specific
  10115.       options for turning individual authentication protocols on and off.
  10116.  
  10117.  
  10118.  
  10119.  
  10120.  
  10121.  
  10122.  
  10123.  
  10124.  
  10125.  
  10126.  
  10127.  
  10128.  
  10129.  
  10130.  
  10131.  
  10132.  
  10133.  
  10134.  
  10135.  
  10136.                                  - 154 -
  10137.  
  10138.  
  10139.  
  10140.       10.  Various Network Applications
  10141.  
  10142.       After  successfully  setting up IP and the resolver, you have to turn to
  10143.       the services you want to provide over the network. This  chapter  covers
  10144.       the  configuration  of  a few simple network applications, including the
  10145.       inetd server, and the programs from the rlogin family.  The Remote  Pro-
  10146.       cedure  Call  interface that services like the Network File System (NFS)
  10147.       and the Network Information System (NIS) are based upon  will  be  dealt
  10148.       with  briefly,  too. The configuration of NFS and NIS, however, takes up
  10149.       more room, will be described in  separate  chapters.   This  applies  to
  10150.       electronic mail and netnews as well.
  10151.  
  10152.  
  10153.            Of course, we can't cover all network applications in this book. If
  10154.       you want to install one that's not discussed here, like talk, gopher, or
  10155.       Xmosaic please refer to its manual pages for details.
  10156.  
  10157.  
  10158.       10.1  The inetd Super-Server
  10159.  
  10160.  
  10161.  
  10162.  
  10163.            Frequently,  services  are performed by so-called daemons. A daemon
  10164.       is a program that opens a certain port, and waits for  incoming  connec-
  10165.       tions.  If one occurs, it creates a child process which accepts the con-
  10166.       nection, while the parent continues  to  listen  for  further  requests.
  10167.       This  concept  has the drawback that for every service offered, a daemon
  10168.       has to run that listens on the port for a  connection  to  occur,  which
  10169.       generally means a waste of system resources like swap space.
  10170.  
  10171.  
  10172.            Thus,  almost  all  Un*x  installations run a ``super-server'' that
  10173.       creates sockets for a number of services, and listens  on  all  of  them
  10174.       simultaneously  using  the  select(2)  system  call.  When a remote host
  10175.       requests one of the services, the super-server notices this  and  spawns
  10176.       the server specified for this port.
  10177.  
  10178.  
  10179.              The super-server commonly used is inetd, the Internet Daemon.  It
  10180.       is started at system boot time, and takes the list of services it is  to
  10181.       manage  from a startup file named /etc/inetd.conf.  In addition to those
  10182.       servers invoked, there are a number of trivial services which  are  per-
  10183.       formed  by  inetd  itself called internal services. They include chargen
  10184.       which simply generates a string of characters, and daytime which returns
  10185.       the system's idea of the time of day.
  10186.  
  10187.  
  10188.            An entry in this file consists of a single line made up of the fol-
  10189.       lowing fields:
  10190.  
  10191.  
  10192.  
  10193.  
  10194.  
  10195.  
  10196.  
  10197.  
  10198.  
  10199.  
  10200.  
  10201.  
  10202.                                  - 155 -
  10203.  
  10204.  
  10205.  
  10206.            service type protocol wait user server cmdline
  10207.  
  10208.  
  10209.  
  10210.  
  10211.       The meaning of each field is as follows:
  10212.  
  10213.  
  10214.  
  10215.  
  10216.         service  gives the service name. The service name has to be translated
  10217.                 to  a  port number by looking it up in the /etc/services file.
  10218.                 This file will be described in section 10.3 below.
  10219.  
  10220.  
  10221.            type specifies  a  socket  type,  either  stream  (for  connection-
  10222.                 oriented  protocols)  or dgram (for datagram protocols).  TCP-
  10223.                 based services should therefore always use stream, while  UDP-
  10224.                 based services should always use dgram.
  10225.  
  10226.  
  10227.        protocol   names  the transport protocol used by the service. This must
  10228.                 be a valid protocol name found in  the  protocols  file,  also
  10229.                 explained below.
  10230.  
  10231.  
  10232.            wait This  option  applies  only to dgram sockets. It may be either
  10233.                 wait or nowait. If wait is specified, inetd will only  execute
  10234.                 one  server  for the specified port at any time. Otherwise, it
  10235.                 will immediately continue to listen on the port after  execut-
  10236.                 ing the server.
  10237.  
  10238.  
  10239.                      This  is useful for ``single-threaded'' servers that read
  10240.                 all incoming datagrams until no more arrive,  and  then  exit.
  10241.                 Most RPC servers are of this type and should therefore specify
  10242.                 wait.  The opposite type, ``multi-threaded'' servers, allow an
  10243.                 unlimited  number  of  instances  to run concurrently; this is
  10244.                 only rarely used. These servers should specify nowait.
  10245.  
  10246.  
  10247.                      stream sockets should always use nowait.
  10248.  
  10249.  
  10250.            user This is the login id of  the  user  the  process  is  executed
  10251.                 under.   This  will frequently be the root user, but some ser-
  10252.                 vices may use different accounts. It is a very  good  idea  to
  10253.                 apply the principle of least privilege here, which states that
  10254.                 you shouldn't run a command under a privileged account if  the
  10255.                 program  doesn't  require  this  for  proper functioning.  For
  10256.                 example, the NNTP news server will run as news, while services
  10257.                 that  may  pose  a  security risk (such as tftp or finger) are
  10258.                 often run as nobody.
  10259.  
  10260.  
  10261.  
  10262.  
  10263.  
  10264.  
  10265.  
  10266.  
  10267.  
  10268.                                  - 156 -
  10269.  
  10270.  
  10271.  
  10272.          server gives the full path name of the server program to be executed.
  10273.                 Internal services are marked by the keyword internal.
  10274.  
  10275.  
  10276.         cmdline This  is  the  command  line  to be passed to the server. This
  10277.                 includes argument 0, that is the command name.  Usually,  this
  10278.                 will  be  the  program  name of the server, unless the program
  10279.                 behaves differently when invoked by a different name.
  10280.  
  10281.  
  10282.                      This field is empty for internal services.
  10283.  
  10284.  
  10285.  
  10286.  
  10287.  
  10288.  
  10289.  
  10290.  
  10291.             A sample inetd.conf file is shown in figure 10.1.  The finger ser-
  10292.       vice commented out, so that it is not available.  This is often done for
  10293.       security reasons, because may be used by attackers to  obtain  names  of
  10294.       users on your system.
  10295.  
  10296.  
  10297.             The tftp is shown commented out as well. tftp implements the Prim-
  10298.       itive File Transfer Protocol that allows to transfer any  world-readable
  10299.       files  from  your  system  without password checking etc.  This is espe-
  10300.       cially harmful with the /etc/passwd file, even more so  when  you  don't
  10301.       use shadow password.
  10302.  
  10303.  
  10304.            TFTP  is commonly used by diskless clients and X terminals to down-
  10305.       load their code from a boot server. If you need to run  tftpd  for  this
  10306.       reason,  make  sure to limit its scope to those directories clients will
  10307.       retrieve files from by adding those directory names to  tftpd's  command
  10308.       line. This is shown in the second tftp line in the example.
  10309.  
  10310.  
  10311.  
  10312.  
  10313.  
  10314.       10.2  The tcpd access control facility
  10315.  
  10316.  
  10317.  
  10318.  
  10319.            Since  opening  a computer to network access involves many security
  10320.       risks, applications are designed  to  guard  against  several  types  of
  10321.       attacks.  Some of these, however, may be flawed (most drastically demon-
  10322.       strated by the RTM Internet worm), or do not distinguish between  secure
  10323.       hosts from which requests for a particular service will be accepted, and
  10324.       insecure hosts whose requests should be  rejected.  We  already  briefly
  10325.       discussed  the  finger and tftp services above.  Thus, one would want to
  10326.  
  10327.  
  10328.  
  10329.  
  10330.  
  10331.  
  10332.  
  10333.  
  10334.                                  - 157 -
  10335.  
  10336.  
  10337.  
  10338.  
  10339.  
  10340.  
  10341.  
  10342.                 #
  10343.                 # inetd services
  10344.                 ftp       stream tcp nowait root   /usr/sbin/ftpd    in.ftpd -l
  10345.                 telnet    stream tcp nowait root   /usr/sbin/telnetd in.telnetd -b/etc/issue
  10346.                 #finger    stream tcp nowait bin    /usr/sbin/fingerd in.fingerd
  10347.                 #tftp      dgram  udp wait   nobody /usr/sbin/tftpd   in.tftpd
  10348.                 #tftp      dgram  udp wait   nobody /usr/sbin/tftpd   in.tftpd /boot/diskless
  10349.                 login     stream tcp nowait root   /usr/sbin/rlogind in.rlogind
  10350.                 shell     stream tcp nowait root   /usr/sbin/rshd    in.rshd
  10351.                 exec      stream tcp nowait root   /usr/sbin/rexecd  in.rexecd
  10352.                 #
  10353.                 #       inetd internal services
  10354.                 #
  10355.                 daytime   stream tcp nowait root internal
  10356.                 daytime   dgram  udp nowait root internal
  10357.                 time      stream tcp nowait root internal
  10358.                 time      dgram  udp nowait root internal
  10359.                 echo      stream tcp nowait root internal
  10360.                 echo      dgram  udp nowait root internal
  10361.                 discard   stream tcp nowait root internal
  10362.                 discard   dgram  udp nowait root internal
  10363.                 chargen   stream tcp nowait root internal
  10364.                 chargen   dgram  udp nowait root internal
  10365.  
  10366.  
  10367.  
  10368.  
  10369.  
  10370.                Figure 15.   A sample /etc/inetd.conf file.
  10371.  
  10372.       limit access to these services  to  ``trusted  hosts''  only,  which  is
  10373.       impossible  with  the usual setup, where inetd either provides this ser-
  10374.       vice to all clients, or not at all.
  10375.  
  10376.  
  10377.            A useful tool for this is tcpd,(1) a so-called daemon wrapper.  For
  10378.       TCP  services  you  want to monitor or protect, it is invoked instead of
  10379.       the server program. tcpd logs the request to the syslog  daemon,  ckecks
  10380.       if the remote host is allowed to use that service, and only if this suc-
  10381.       ceeds will it executes the real server program. Note that this does  not
  10382.       work with UDP-based services.
  10383.  
  10384.  
  10385.            For example, to wrap the finger daemon, you have to change the cor-
  10386.       responding line in inetd.conf to
  10387.  
  10388.  
  10389.  
  10390.       
  10391.  
  10392.       1. Written by Wietse Venema, wietse@wzv.win.tue.nl.
  10393.  
  10394.  
  10395.  
  10396.  
  10397.  
  10398.  
  10399.  
  10400.                                  - 158 -
  10401.  
  10402.  
  10403.  
  10404.            # wrap finger daemon
  10405.            finger  stream  tcp     nowait  root    /usr/sbin/tcpd   in.fingerd
  10406.  
  10407.  
  10408.  
  10409.  
  10410.              Without adding any access control, this will appear to the client
  10411.       just as a usual finger setup, except that any  requests  are  logged  to
  10412.       syslog's auth facility.
  10413.  
  10414.  
  10415.            Access  control  is  implemented  by  means  of  two  files  called
  10416.       /etc/hosts.allow and /etc/hosts.deny.  They contain entries allowing and
  10417.       denying  access, respectively, to certain services and hosts.  When tcpd
  10418.       handles a request for a service such as finger from a client host  named
  10419.       biff.foobar.com, it scans hosts.allow and hosts.deny (in this order) for
  10420.       an entry matching both the service and client host. If a matching  entry
  10421.       is  found  in hosts.allow, access is granted, regardless of any entry in
  10422.       hosts.deny. If a match is found in hosts.deny, the request  is  rejected
  10423.       by closing down the connection. If no match is found at all, the request
  10424.       is accepted.
  10425.  
  10426.  
  10427.            Entries in the access files look like this:
  10428.  
  10429.  
  10430.            servicelist: hostlist [:shellcmd]
  10431.  
  10432.  
  10433.  
  10434.  
  10435.            servicelist is a list of service names from /etc/services,  or  the
  10436.       keyword  ALL.  To  match  all services except finger and tftp, use ``ALL
  10437.       EXCEPT finger, tftp''.
  10438.  
  10439.  
  10440.            hostlist is a list of host names or IP addresses, or  the  keywords
  10441.       ALL,  LOCAL,  or UNKNOWN. ALL matches any host, while LOCAL matches host
  10442.       names  not  containing a dot.(2) UNKNOWN matches any hosts whose name or
  10443.       address lookup failed.  A name starting with a  dot  matches  all  hosts
  10444.       whose  domain  is  equal  to this name. For example, .foobar.com matches
  10445.       biff.foobar.com.  There are also provisions for IP network addresses and
  10446.       subnet  numbers.   Please  refer  to the hosts access(5) manual page for
  10447.       details.
  10448.  
  10449.  
  10450.            To deny access to the finger and tftp services to all but the local
  10451.       hosts,  put the following in /etc/hosts.deny, and leave /etc/hosts.allow
  10452.       empty:
  10453.  
  10454.  
  10455.  
  10456.       
  10457.  
  10458.       2. Usually only local host names obtained  from  lookups  in
  10459.          /etc/hosts contain no dots.
  10460.  
  10461.  
  10462.  
  10463.  
  10464.  
  10465.  
  10466.  
  10467.                                  - 159 -
  10468.  
  10469.  
  10470.  
  10471.            in.tftpd, in.fingerd: ALL EXCEPT LOCAL, .your.domain
  10472.  
  10473.  
  10474.  
  10475.  
  10476.            The  optional  shellcmd  field  may  contain  a shell command to be
  10477.       invoked when the entry is matched. This is useful to set up  traps  that
  10478.       may expose potential attackers:
  10479.  
  10480.  
  10481.  
  10482.            in.ftpd: ALL EXCEPT LOCAL, .vbrew.com : \
  10483.                  echo "request from %d@%h" >> /var/log/finger.log; \
  10484.                  if [ %h != "vlager.vbrew.com" ]; then \
  10485.                      finger -l @%h >> /var/log/finger.log \
  10486.                  fi
  10487.  
  10488.  
  10489.  
  10490.  
  10491.            The  %h  and  %d  arguments are expanded by tcpd to the client host
  10492.       name and service name, respectively. Please refer to the hosts access(5)
  10493.       manual page for details.
  10494.  
  10495.  
  10496.  
  10497.  
  10498.  
  10499.       10.3  The services and protocols Files
  10500.  
  10501.  
  10502.  
  10503.  
  10504.            The port numbers on which certain ``standard'' services are offered
  10505.       are defined in the ``Assigned Numbers'' RFC. To enable server and client
  10506.       programs  to  convert service names to these numbers, at least a part of
  10507.       the list  is  kept  on  each  host;  it  is  stored  in  a  file  called
  10508.       /etc/services.  An entry is made up like this:
  10509.  
  10510.  
  10511.            service port/protocol   [aliases]
  10512.  
  10513.  
  10514.  
  10515.  
  10516.            Here, service specifies the service name, port defines the port the
  10517.       service is offered on, and protocol defines which transport protocol  is
  10518.       used.  Commonly, this is either udp or tcp. It is possible for a service
  10519.       to be offered for more than one protocol, as well as offering  different
  10520.       services  on  the same port, as long as the protocols are different. The
  10521.       aliases field allows to specify alternative names for the same  service.
  10522.  
  10523.  
  10524.            Usually,  you  don't  have  to  change the services file that comes
  10525.  
  10526.  
  10527.  
  10528.  
  10529.  
  10530.  
  10531.  
  10532.  
  10533.                                  - 160 -
  10534.  
  10535.  
  10536.  
  10537.       along with the network software on your Linux system.  Nevertheless,  we
  10538.       give a small excerpt from that file below.
  10539.  
  10540.  
  10541.  
  10542.            # The services file:
  10543.            #
  10544.            # well-known services
  10545.            echo           7/tcp                 # Echo
  10546.            echo           7/udp                 #
  10547.            discard        9/tcp  sink null      # Discard
  10548.            discard        9/udp  sink null      #
  10549.            daytime       13/tcp                 # Daytime
  10550.            daytime       13/udp                 #
  10551.            chargen       19/tcp  ttytst source  # Character Generator
  10552.            chargen       19/udp  ttytst source  #
  10553.            ftp-data      20/tcp                 # File Transfer Protocol (Data)
  10554.            ftp           21/tcp                 # File Transfer Protocol (Control)
  10555.            telnet        23/tcp                 # Virtual Terminal Protocol
  10556.            smtp          25/tcp                 # Simple Mail Transfer Protocol
  10557.            nntp         119/tcp  readnews       # Network News Transfer Protocol
  10558.            #
  10559.            # UNIX services
  10560.            exec         512/tcp                 # BSD rexecd
  10561.            biff         512/udp  comsat         # mail notification
  10562.            login        513/tcp                 # remote login
  10563.            who          513/udp  whod           # remote who and uptime
  10564.            shell        514/tcp  cmd            # remote command, no passwd used
  10565.            syslog       514/udp                 # remote system logging
  10566.            printer      515/tcp  spooler        # remote print spooling
  10567.            route        520/udp  router routed  # routing information protocol
  10568.  
  10569.  
  10570.  
  10571.  
  10572.            Note  that,  for example, the echo service is offered on port 7 for
  10573.       both TCP and UDP, and that port 512 is used for two different  services,
  10574.       namely  the  COMSAT  daemon (which notifies users of newly arrived mail,
  10575.       see xbiff(1x)), over UDP, and for  remote  execution  (rexec(1)),  using
  10576.       TCP.
  10577.  
  10578.  
  10579.              Similar  to the services file, the networking library needs a way
  10580.       to translate protocol names --- for example, those used in the  services
  10581.       file  --- to protocol numbers understood by the IP layer on other hosts.
  10582.       This is done by looking up the name in the /etc/protocols file.  It con-
  10583.       tains one entry per line, each containing a protocol name, and the asso-
  10584.       ciated number. Having to touch this file is even more unlikely than hav-
  10585.       ing to meddle with /etc/services. A sample file is given below:
  10586.  
  10587.  
  10588.  
  10589.  
  10590.  
  10591.  
  10592.  
  10593.  
  10594.  
  10595.  
  10596.  
  10597.  
  10598.  
  10599.                                  - 161 -
  10600.  
  10601.  
  10602.  
  10603.            #
  10604.            # Internet (IP) protocols
  10605.            #
  10606.            ip      0       IP              # internet protocol, pseudo protocol number
  10607.            icmp    1       ICMP            # internet control message protocol
  10608.            igmp    2       IGMP            # internet group multicast protocol
  10609.            tcp     6       TCP             # transmission control protocol
  10610.            udp     17      UDP             # user datagram protocol
  10611.            raw     255     RAW             # RAW IP interface
  10612.  
  10613.  
  10614.  
  10615.  
  10616.  
  10617.  
  10618.  
  10619.       10.4  Remote Procedure Call
  10620.  
  10621.  
  10622.  
  10623.  
  10624.            A very general mechanism for client-server applications is provided
  10625.       by RPC, the Remote Procedure Call package.  RPC  was  developed  by  Sun
  10626.       Micrsystems, and is a collection of tools and library functions.  Impor-
  10627.       tant applications built on top of RPC are NFS, the  Network  Filesystem,
  10628.       and  NIS,  the  Network Information System, both of which will be intro-
  10629.       duced in later chapters.
  10630.  
  10631.  
  10632.             An RPC server consists of a collection of procedures  that  client
  10633.       may  call by sending an RPC request to the server, along with the proce-
  10634.       dure parameters. The server  will  invoke  the  indicated  procedure  on
  10635.       behalf  of  the  client, handing back the return value, if there is any.
  10636.       In order to be machine-independent, all data  exchanged  between  client
  10637.       and server is converted to a so-called External Data Representation for-
  10638.       mat (XDR) by the sender, and converted back to the machine-local  repre-
  10639.       sentation by the receiver.
  10640.  
  10641.  
  10642.            Sometimes,  improvements to an RPC application introduce incompati-
  10643.       ble changes in the procedure call interface. Of course, simply  changing
  10644.       the  server  would  crash all application that still expect the original
  10645.       behavior.  Therefore, RPC programs  have  version  numbers  assigned  to
  10646.       them,  usually  starting  with  1,  and with each new version of the RPC
  10647.       interface this counter will be bumped. Often, a server may offer several
  10648.       versions  simultaneously; clients then indicate by the version number in
  10649.       their requests which implementation of the service they want to use.
  10650.  
  10651.  
  10652.             The network communication between RPC servers and clients is some-
  10653.       what  peculiar.  An  RPC server offers one or more collections of proce-
  10654.       dures; each set is being called a program, and is uniquely identified by
  10655.       a  program  number.  A  list mapping service names to program numbers is
  10656.       usually kept in /etc/rpc, an excerpt of which  is  reproduced  below  in
  10657.  
  10658.  
  10659.  
  10660.  
  10661.  
  10662.  
  10663.  
  10664.  
  10665.                                  - 162 -
  10666.  
  10667.  
  10668.  
  10669.       figure 10.4.
  10670.  
  10671.  
  10672.  
  10673.  
  10674.  
  10675.            In TCP/IP networks, the authors of RPC were faced with  the problem
  10676.       of mapping program numbers to generic network services.  They  chose  to
  10677.       have  each server provide both a TCP and a UDP port for each program and
  10678.       each version. Generally, RPC applications  will  use  UDP  when  sending
  10679.       data,  and only fall back to TCP when the data to be transferred doesn't
  10680.       fit into a single UDP datagram.
  10681.  
  10682.  
  10683.             Of course, client programs have to have a way to  find  out  which
  10684.       port a program number maps to. Using a configuration file for this would
  10685.       be too unflexible; since RPC  applications  don't  use  reserved  ports,
  10686.       there's  no  guarantee  that  a  port originally meant to be used by our
  10687.       database application hasn't been taken by some other process. Therefore,
  10688.       RPC  applications  pick  any port they can get, and register it with the
  10689.       so-called portmapper daemon. The latter acts as a service broker for all
  10690.       RPC  servers  running  on its machine: a client that wishes to contact a
  10691.       service with a given program number will first query the  portmapper  on
  10692.       the server's host which returns the TCP and UDP port numbers the service
  10693.       can be reached at.
  10694.  
  10695.  
  10696.             This method has the particular drawback that it introduces a  sin-
  10697.       gle  point  of failure, much like the inetd daemon does for the standard
  10698.       Berkeley services. However, this case is even a  little  worse,  because
  10699.       when the portmapper dies, all RPC port information is lost; this usually
  10700.       means you have to restart all RPC servers manually, or reboot the entire
  10701.       machine.
  10702.  
  10703.  
  10704.            On  Linux,  the  portmapper  is  called  rpc.portmap and resides in
  10705.       /usr/sbin. Other than making sure  it  is  started  form  rc.inet2,  the
  10706.       portmapper doesn't require any configuration work.
  10707.  
  10708.  
  10709.  
  10710.  
  10711.  
  10712.       10.5  Configuring the r Commands
  10713.  
  10714.  
  10715.  
  10716.  
  10717.            There  are  a  number  of commands for executing commands on remote
  10718.       hosts. These are rlogin, rsh, rcp and rcmd.  They all spawn a  shell  on
  10719.       the  remote  host and allow the user to execute commands. Of course, the
  10720.       client needs to have an account on the host where the commmand is to  be
  10721.       executed.  Thus  all  these commands perform an authorization procedure.
  10722.       Usually, the client will tell the user's login name to the server, which
  10723.  
  10724.  
  10725.  
  10726.  
  10727.  
  10728.  
  10729.  
  10730.  
  10731.                                  - 163 -
  10732.  
  10733.  
  10734.  
  10735.  
  10736.  
  10737.  
  10738.  
  10739.                 #
  10740.                 # /etc/rpc - miscellaenous RPC-based services
  10741.                 #
  10742.                 portmapper      100000  portmap sunrpc
  10743.                 rstatd          100001  rstat rstat svc rup perfmeter
  10744.                 rusersd         100002  rusers
  10745.                 nfs             100003  nfsprog
  10746.                 ypserv          100004  ypprog
  10747.                 mountd          100005  mount showmount
  10748.                 ypbind          100007
  10749.                 walld           100008  rwall shutdown
  10750.                 yppasswdd       100009  yppasswd
  10751.                 bootparam       100026
  10752.                 ypupdated       100028  ypupdate
  10753.  
  10754.  
  10755.  
  10756.  
  10757.  
  10758.                    Figure 16.   A sample /etc/rpc file.
  10759.  
  10760.       in turn requests a password that is validated in the usual way.
  10761.  
  10762.  
  10763.            Sometimes,  however,  it is desirable to relax authorization checks
  10764.       for certain users.  For instance, if you frequently  have  to  log  into
  10765.       other machines on your LAN, you might want to be admitted without having
  10766.       to type your password every time.
  10767.  
  10768.  
  10769.            Disabling authorization is advisable only  on  a  small  number  of
  10770.       hosts  whose  password databases are synchronized, or for a small number
  10771.       of privileged users who need to access many machines for  administrative
  10772.       reasons. Whenever you want to allow people to log into your host without
  10773.       having to specify a login id or password, make sure that you don't acci-
  10774.       dentally grant access to anybody else.
  10775.  
  10776.  
  10777.              There are two ways to disable authorization checks for the r com-
  10778.       mands. One is for the super user to allow certain or all users  on  cer-
  10779.       tain  or  all  hosts  (the latter definitely being a bad idea) to log in
  10780.       without being asked for a password. This access is controlled by a  file
  10781.       called  /etc/hosts.equiv. It contains a list of host and user names that
  10782.       are considered equivalent to users on the local  host.   An  alternative
  10783.       option is for a user to grant other users on certain hosts access to her
  10784.       account. These may be listed in the file  .rhosts  in  the  user's  home
  10785.       directory.  For security reasons, this file must be owned by the user or
  10786.       the super user, and must not be a symbolic link, otherwise  it  will  be
  10787.       ignored.(3)
  10788.  
  10789.       
  10790.  
  10791.  
  10792.  
  10793.  
  10794.  
  10795.  
  10796.  
  10797.  
  10798.                                  - 164 -
  10799.  
  10800.  
  10801.  
  10802.            When  a  client  requests  an r service, her host and user name are
  10803.       searched in the /etc/hosts.equiv file, and then in the .rhosts  file  of
  10804.       the  user she wants to log in as. As am example, assume janet is working
  10805.       on gauss and tries to log into joe's account on  euler.  Throughout  the
  10806.       following,  we will refer to Janet as the client user, and to Joe as the
  10807.       local user.  Now, when Janet types
  10808.  
  10809.  
  10810.            $ rlogin -l joe euler
  10811.  
  10812.  
  10813.  
  10814.  
  10815.       on  gauss, the server will first check hosts.equiv(4) if Janet should be
  10816.       granted free access, and if this fails, it will try to look  her  up  in
  10817.       .rhosts in joe's home directory.
  10818.  
  10819.  
  10820.            The hosts.equiv file on euler looks like this:
  10821.  
  10822.  
  10823.  
  10824.            gauss
  10825.            euler
  10826.            -public
  10827.            quark.physics.groucho.edu     andres
  10828.  
  10829.  
  10830.  
  10831.  
  10832.            An entry consists of a host name, optionally  followed  by  a  user
  10833.       name.   If  a  host name appears all by itself, all users from that host
  10834.       will be admitted to their local accounts  without  any  checks.  In  the
  10835.       above example, Janet would be allowed to log into her account janet when
  10836.       coming from gauss, and the same applies to any other user  except  root.
  10837.       However,  if  Janet  wants  to log in as joe, she will be prompted for a
  10838.       password as usual.
  10839.  
  10840.  
  10841.            If a host name is followed by a user name, as in the last  line  of
  10842.       the  above  sample  file, this user is given password-free access to all
  10843.       accounts except the root account.
  10844.  
  10845.  
  10846.            The host name may also be preceded by a minus sign, as in the entry
  10847.       ``-public''.  This  requires  authorization  for all accounts on public,
  10848.       regardless of what rights individual users grant in their .rhosts  file.
  10849.  
  10850.  
  10851.       
  10852.  
  10853.       3. In  an  NFS  environment,  you  may  need  to  give  it a
  10854.          protection of 444, because the super user is  often  very
  10855.          restricted in accessing files on disks mounted via NFS.
  10856.       4. Note that the  hosts.equiv  file  is  not  searched  when
  10857.          someone attempts to log in as root.
  10858.  
  10859.  
  10860.  
  10861.  
  10862.  
  10863.  
  10864.  
  10865.                                  - 165 -
  10866.  
  10867.  
  10868.  
  10869.            The format of the .rhosts file is identical to that of hosts.equiv,
  10870.       but its meaning is  a little different. Consider Joe's .rhosts  file  on
  10871.       euler:
  10872.  
  10873.  
  10874.  
  10875.            chomp.cs.groucho.edu
  10876.            gauss      janet
  10877.  
  10878.  
  10879.  
  10880.  
  10881.            The  first  entry  grants  joe  free  acess  when  logging  in from
  10882.       chomp.cs.groucho.edu, but does  not  affect  the  rights  of  any  other
  10883.       account  on  euler  or  chomp. The second entry is a slight variation of
  10884.       this, in that it grants janet free access to Joe's account when  logging
  10885.       in from gauss.
  10886.  
  10887.  
  10888.            Note that the client's host name is obtained by reverse mapping the
  10889.       caller's address to a name, so that this feature will  fail  with  hosts
  10890.       unknown  to  the resolver. The client's host name is considered to match
  10891.       the name in the hosts files in one of the following cases:
  10892.  
  10893.  
  10894.  
  10895.  
  10896.               + The client's canonical host  name  (not  an  alias)  literally
  10897.                 matches the host name in the file.
  10898.  
  10899.  
  10900.               + If  the  client's  host  name is a fully qualified domain name
  10901.                 (such as returned by the resolver when you have DNS  running),
  10902.                 and  it  doesn't  literally  match  the host name in the hosts
  10903.                 file, it is compared to that host name expanded with the local
  10904.                 domain name.
  10905.  
  10906.  
  10907.  
  10908.  
  10909.  
  10910.  
  10911.  
  10912.  
  10913.  
  10914.  
  10915.  
  10916.  
  10917.  
  10918.  
  10919.  
  10920.  
  10921.  
  10922.  
  10923.  
  10924.  
  10925.  
  10926.  
  10927.  
  10928.  
  10929.  
  10930.  
  10931.                                  - 166 -
  10932.  
  10933.  
  10934.  
  10935.       11.  The Network Information System
  10936.  
  10937.  
  10938.  
  10939.  
  10940.            When  you  are  running  a local area network, your overall goal is
  10941.       usually to provide an environment to your users that makes  the  network
  10942.       transparent.   An  important stepping stone to this end is to keep vital
  10943.       data such as user account information synchronized  between  all  hosts.
  10944.       We  have  seen  before  that  for  host  name resolution, a powerful and
  10945.       sophisticated service exists, being DNS. For others tasks, there  is  no
  10946.       such  specialized service. Moreover, if you manage only a small LAN with
  10947.       no Internet connectivity, setting up DNS may not seem worth the  trouble
  10948.       for many administrators.
  10949.  
  10950.  
  10951.            This is why Sun developed NIS, the Network Information System.  NIS
  10952.       provides generic database access facilities that can  be  used  to  dis-
  10953.       tribute  information  such  as  that  contained in the passwd and groups
  10954.       files to all hosts on your network.  This makes the network appear  just
  10955.       as  a  single  system, with the same accounts on all hosts. In a similar
  10956.       fashion, you can use NIS to distribute  the  hostname  information  form
  10957.       /etc/hosts to all machines on the network.
  10958.  
  10959.  
  10960.            NIS is based on RPC, and comprises a server, a client-side library,
  10961.       and several administrative tools.  Originally,  NIS  was  called  Yellow
  10962.       Pages,  or  YP, which is still widely used to informally refer this ser-
  10963.       vice. On the other hand, Yellow Pages is a trademark of British Telecom,
  10964.       which  required  Sun  to  drop that name. As things go, some names stick
  10965.       with people, and so YP lives on as a prefix to the names  of  most  NIS-
  10966.       related commands such as ypserv, ypbind, etc.
  10967.  
  10968.  
  10969.              Today,  NIS  is available for virtually all Un*ces, and there are
  10970.       even free implementations of it. One is from the BSD Net-2 release,  and
  10971.       has  been  derived from a public domain reference implementation donated
  10972.       by Sun.  The library client code from this release has been in  the  GNU
  10973.       libc  for  a  long  time,  while  the  administrative programs have only
  10974.       recently been ported to Linux by Swen Thmmler.(1) An NIS server is miss-
  10975.       ing from the reference implementation.  Tobias Reber has written another
  10976.       NIS package including all tools and a server; it is called yps.(2)
  10977.  
  10978.  
  10979.             Currently, a complete rewrite of the NIS code called NYS is  being
  10980.       done  by Peter Eriksson,(3) which supports both plain NIS and Sun's much
  10981.       
  10982.  
  10983.       1. To be reached at swen@uni-paderborn.de. The  NIS  clients
  10984.          are  available as yp-linux.tar.gz from sunsite.unc.edu in
  10985.          system/Network.
  10986.       2. The current version (as of this writing) is yps-0.21  and
  10987.          can  be  obtained from ftp.lysator.liu.se in the /pub/NYS
  10988.          directory.
  10989.       3. To be reached at pen@lysator.liu.se.
  10990.  
  10991.  
  10992.  
  10993.  
  10994.  
  10995.  
  10996.  
  10997.                                  - 167 -
  10998.  
  10999.  
  11000.  
  11001.       revised NIS+. NYS not only provides a set of NIS tools and a server, but
  11002.       also  adds a whole new set of library functions which will most probably
  11003.       make it into the standard libc eventually. This includes a new  configu-
  11004.       ration  scheme  for hostname resolution that replaces the current scheme
  11005.       using host.conf. The features  of  these  functions  will  be  discussed
  11006.       below.
  11007.  
  11008.  
  11009.            This  chapter will focus on NYS rather than the other two packages,
  11010.       to which I will refer as the ``traditional'' NIS code. If you do want to
  11011.       run  any  of these packages, the instructions in this chapter may or may
  11012.       not be enough.  To obtain additional information, please get a  standard
  11013.       book  on  NIS,  such as Hal Stern's NFS and NIS (see [ GETST "stern-nfs"
  11014.       ]).
  11015.  
  11016.  
  11017.            For the time being, NYS is still under development,  and  therefore
  11018.       standard  Linux utilities such as the network programs or the login pro-
  11019.       gram are not yet aware of the NYS configuration scheme.   Until  NYS  is
  11020.       merged  into  the  mainstream  libc  you therefore have to recompile all
  11021.       these binaries if you want to make them use NYS.  In any of these appli-
  11022.       cations'  Makefiles, specify -lnsl as the last option before libc to the
  11023.       linker. This links in  the  relevant  functions  from  libnsl,  the  NYS
  11024.       library, instead of the standard C library.
  11025.  
  11026.  
  11027.       11.1  Getting Acquainted with NIS
  11028.  
  11029.  
  11030.  
  11031.  
  11032.            NIS keeps database information is in so-called maps containing key-
  11033.       value pairs. Maps are stored on a central host running the  NIS  server,
  11034.       from  which  clients  may  retrieve  the information through various RPC
  11035.       calls. Quite frequently, maps are stored in DBM files.(4)
  11036.  
  11037.  
  11038.              The  maps themselves are usually generated from master text files
  11039.       such as /etc/hosts or /etc/passwd. For some files, several maps are cre-
  11040.       ated,  one  for  each  search key type. For instance, you may search the
  11041.       hosts file for a host name as well as for an IP  address.   Accordingly,
  11042.       two  NIS maps are derived from it, called hosts.byname and hosts.byaddr,
  11043.       respectively.  Table 11.1 lists common maps and the files they are  gen-
  11044.       erated form.
  11045.  
  11046.  
  11047.  
  11048.  
  11049.  
  11050.  
  11051.       
  11052.  
  11053.       4. DBM is a simple database  management  library  that  uses
  11054.          hashing techniques to speed up search operations. There's
  11055.          a free DBM implementation from  the  GNU  project  called
  11056.          gdbm, which is part of most Linux distributions.
  11057.  
  11058.  
  11059.  
  11060.  
  11061.  
  11062.  
  11063.  
  11064.                                  - 168 -
  11065.  
  11066.  
  11067.  
  11068.  
  11069.         -----------------------------------------------------------
  11070.         +-----------------+---------------------------------------+
  11071.         |Master File      | Map(s)                                |
  11072.         +-----------------+---------------------------------------+
  11073.         +-----------------+---------------------------------------+
  11074.         |/etc/hosts       | hosts.byname       hosts.byaddr       |
  11075.         |/etc/networks    | networks.byname    networks.byaddr    |
  11076.         |/etc/passwd      | passwd.byname      passwd.byuid       |
  11077.         |/etc/group       | group.byname       group.bygid        |
  11078.         |/etc/services    | services.byname    services.bynumber  |
  11079.         |/etc/rpc         | rpc.byname         rpc.bynumber       |
  11080.         |/etc/protocols   | protocols.byname   protocols.bynumber |
  11081.         |/usr/lib/aliases | mail.aliases                          |
  11082.         +-----------------+---------------------------------------+
  11083.         +-----------------+---------------------------------------+
  11084.  
  11085.  
  11086.  
  11087.  
  11088.         TABLE 1.   Some standard NIS maps and the corresponding files.
  11089.  
  11090.  
  11091.            There are other files and maps you may find support for in some NIS
  11092.       package  or  other.  These  may contain information for applications not
  11093.       discussed in this book, such as the bootparams map that may used by some
  11094.       BOOTP servers, or which currently don't have any function in Linux (like
  11095.       the ethers.byname and ethers.byaddr maps).
  11096.  
  11097.  
  11098.             For some maps, people commonly use nicknames,  which  are  shorter
  11099.       and  therefore easier to type. To obtain a full list of nicknames under-
  11100.       stood by your NIS tools, run the following command:
  11101.  
  11102.  
  11103.  
  11104.            $ ypcat -x
  11105.            NIS map nickname translation table:
  11106.                    "passwd" -> "passwd.byname"
  11107.                    "group" -> "group.byname"
  11108.                    "networks" -> "networks.byaddr"
  11109.                    "hosts" -> "hosts.byname"
  11110.                    "protocols" -> "protocols.bynumber"
  11111.                    "services" -> "services.byname"
  11112.                    "aliases" -> "mail.aliases"
  11113.                    "ethers" -> "ethers.byname"
  11114.                    "rpc" -> "rpc.bynumber"
  11115.                    "netmasks" -> "netmasks.byaddr"
  11116.                    "publickey" -> "publickey.byname"
  11117.                    "netid" -> "netid.byname"
  11118.                    "passwd.adjunct" -> "passwd.adjunct.byname"
  11119.                    "group.adjunct" -> "group.adjunct.byname"
  11120.                    "timezone" -> "timezone.byname"
  11121.  
  11122.  
  11123.  
  11124.  
  11125.  
  11126.  
  11127.  
  11128.  
  11129.  
  11130.                                  - 169 -
  11131.  
  11132.  
  11133.  
  11134.             The NIS server is traditionally called ypserv. For an average net-
  11135.       work, a single server usually suffices; large networks may choose to run
  11136.       several  of  these  on  different machines and different segments of the
  11137.       network to relieve the load on the server machines and  routers.   These
  11138.       servers  are  synchronized  by making one of them the master server, and
  11139.       the others slave servers. Maps  will  be  created  only  on  the  master
  11140.       server's host. From there, they are distributed to all slaves.
  11141.  
  11142.  
  11143.             You will have noticed that we have been talking about ``networks''
  11144.       very vaguely all the time; of course there's a  distinctive  concept  in
  11145.       NIS  that  refers to such a network, that is the collection of all hosts
  11146.       that share part of their system configuration data through NIS: the  NIS
  11147.       domain.   Unfortunately,  NIS  domains have absolutely nothing in common
  11148.       with the domains we encountered in DNS. To avoid any ambiguity  through-
  11149.       out this chapter, I will therefore always specify which type of domain I
  11150.       mean.
  11151.  
  11152.  
  11153.             NIS domains have a purely administrative function only.  They  are
  11154.       mostly  invisible  to users, except for the sharing of passwords between
  11155.       all machines in the domain. Therefore, the name given to a NIS domain is
  11156.       relevant  only to the administrators. Usually, any name will do, as long
  11157.       as it is different from any other NIS domain name on your local network.
  11158.       For  instance,  the  administrator  at the Virtual Brewery may choose to
  11159.       create two NIS domains, one for the Brewery itself, and one for the Win-
  11160.       ery,  which  she  names brewery and winery, respectively.  Another quite
  11161.       common scheme is to simply use the DNS domain name for NIS as  well.  To
  11162.       set  and  display  the  NIS  domain  name  of your host, you can use the
  11163.       domainname command. When invoked without any  argument,  it  prints  the
  11164.       current  NIS  domain name; to set the domain name, you must become super
  11165.       user and type:
  11166.  
  11167.  
  11168.            # domainname brewery
  11169.  
  11170.  
  11171.  
  11172.  
  11173.            NIS domains determine which NIS server an application  will  query.
  11174.       For  instance,  the  login  program  on  a host at the Winery should, of
  11175.       course, only query the Winery's NIS server (or one  of  them,  if  there
  11176.       were several) for a user's password information; while an application on
  11177.       a Brewery host should stick with the Brewery's server.
  11178.  
  11179.  
  11180.             One mystery now remains to be solved, namely how  a  client  finds
  11181.       out which server to connect to. The simplest approach would be to have a
  11182.       configuration file that names the host on  which  to  find  the  server.
  11183.       However,  this  approach  is rather inflexible, because it doesn't allow
  11184.       clients to use different servers (from  the  same  domain,  of  course),
  11185.       depending  on their availability. Therefore, traditional NIS implementa-
  11186.       tions rely on a special daemon called ypbind to detect  a  suitable  NIS
  11187.       server  in  their  NIS  domain.  Before  being  able  to perform any NIS
  11188.  
  11189.  
  11190.  
  11191.  
  11192.  
  11193.  
  11194.  
  11195.  
  11196.                                  - 170 -
  11197.  
  11198.  
  11199.  
  11200.       queries, any application first finds out from  ypbind  which  server  to
  11201.       use.
  11202.  
  11203.  
  11204.            ypbind  probes for servers by broadcasting to the local IP network;
  11205.       the first to respond is assumed to be the potentially  fastest  one  and
  11206.       will be used in all subsequent NIS queries. After a certain interval has
  11207.       elapsed, or if the server becomes unavailable,  ypbind  will  probe  for
  11208.       active servers again.
  11209.  
  11210.  
  11211.            Now,  the  arguable  point about dynamic binding is that you rarely
  11212.       need it, and that it  introduces  a  security  problem:  ypbind  blindly
  11213.       believes  whoever answers, which could be a humble NIS server as well as
  11214.       a malicious intruder. Needless to say this becomes  especially  trouble-
  11215.       some  if  you manage your password databases over NIS.  To guard against
  11216.       this, NYS does not use ypbind by default, but rather picks up the server
  11217.       host name from a configuration file.
  11218.  
  11219.  
  11220.  
  11221.  
  11222.  
  11223.       11.2  NIS versus NIS+
  11224.  
  11225.  
  11226.  
  11227.  
  11228.            NIS  and  NIS+ share little more than their name and a common goal.
  11229.       NIS+ is structured in an entirely different way. Instead of a flat  name
  11230.       space with disjoint NIS domains, it uses a hierarchical name space simi-
  11231.       lar to that of DNS. Instead of maps, so called tables are used that  are
  11232.       made  up of rows and columns, where each row represents an object in the
  11233.       NIS+ database, while the columns cover those properties of  the  objects
  11234.       that NIS+ knows and cares about. Each table for a given NIS+ domain com-
  11235.       prises those of its parent domains. In addition, an entry in a table may
  11236.       contain  a  link  to  another  table. These features make it possible to
  11237.       structure information in many ways.
  11238.  
  11239.  
  11240.            Traditional NIS has an RPC version number of 2, while NIS+ is  ver-
  11241.       sion 3.
  11242.  
  11243.  
  11244.            NIS+  does  not seem to be very widely used yet, and I don't really
  11245.       know that much about it. (Well, almost nothing).  For  this  reason,  we
  11246.       will not deal with it here. If you are interested in learning more about
  11247.       it, please refer to Sun's NIS+ administration manual ([ GETST  "nisplus"
  11248.       ]).
  11249.  
  11250.  
  11251.       11.3  The Client Side of NIS
  11252.  
  11253.  
  11254.  
  11255.  
  11256.  
  11257.  
  11258.  
  11259.  
  11260.  
  11261.  
  11262.                                  - 171 -
  11263.  
  11264.  
  11265.  
  11266.            If  you  are familiar with writing or porting network applications,
  11267.       you will notice that most NIS maps listed above  correspond  to  library
  11268.       functions  in the C library. For instance, to obtain passwd information,
  11269.       you generally use the getpwnam(3) and getpwuid(3) functions which return
  11270.       the account information associated with the given user name or numerical
  11271.       user id, repsectively.  Under normal circumstances, these functions will
  11272.       perform  the requested lookup on the standard file, such as /etc/passwd.
  11273.  
  11274.  
  11275.            A NIS-aware implementation of these functions, however, will modify
  11276.       this  behavior, and place an RPC call to have the NIS server look up the
  11277.       user name or id. This happens completely transparent to the application.
  11278.       The  function  may  either  ``append'' the NIS map to or ``replace'' the
  11279.       original file with it. Of course, this does not refer to a real  modifi-
  11280.       cation  of the file, it only means that it appears to the application as
  11281.       if the file had been replaced or appended to.
  11282.  
  11283.  
  11284.            For traditional NIS implementations, there used to be certain  con-
  11285.       ventions as to which maps replaced, and which were appended to the orig-
  11286.       inal information.  Some, like the passwd maps, required kludgy modifica-
  11287.       tions  of the passwd file which, when done wrong, would open up security
  11288.       holes. To avoid these pitfalls, NYS uses a general configuration  scheme
  11289.       that  determines  whether  a particular set of client functions uses the
  11290.       original files, NIS, or NIS+, and in which order. It will  be  described
  11291.       in a later section of this chapter.
  11292.  
  11293.  
  11294.  
  11295.  
  11296.  
  11297.       11.4  Running a NIS Server
  11298.  
  11299.  
  11300.  
  11301.  
  11302.            After so much theoretical techno-babble, it's time to get our hands
  11303.       dirty with actual configuration work. In this section, we will cover the
  11304.       configuration  of  a NIS server. If there's already a NIS server running
  11305.       on your network, you won't have to set up your own server; in this case,
  11306.       you may safely skip this section.
  11307.  
  11308.  
  11309. <>   Note  that  if  you are just going to experiment with the
  11310.      server, make sure you don't set it up for  a  NIS  domain
  11311.      name  that  is  already  in use on your network. This may
  11312.      disrupt the entire network service and make a lot of peo-
  11313.      ple very unhappy, and very angry.
  11314.  
  11315.  
  11316.  
  11317.      There are currently two NIS servers freely available for Linux, one
  11318. contained  in  Tobias Reber's yps package, and the other in Peter Eriks-
  11319. son's ypserv package. It shouldn't matter which one you run,  regardless
  11320.  
  11321.  
  11322.  
  11323.  
  11324.  
  11325.  
  11326.  
  11327.  
  11328.                            - 172 -
  11329.  
  11330.  
  11331.  
  11332. of  whether  you use NYS or the standard NIS client code that is in libc
  11333. currently. At the time of this writing, the code for the handling of NIS
  11334. slave  servers  seems to be more complete in yps. So if you have to deal
  11335. with slave servers, yps might be a better choice.
  11336.  
  11337.  
  11338.      After installing the server  program  (ypserv)  in  /usr/sbin,  you
  11339. should  create  the  directory  that is going to hold the map files your
  11340. server is to distribute. When setting up a NIS domain  for  the  brewery
  11341. domain,  the maps would go to /var/yp/brewery.  The server determines if
  11342. it is serving a particular NIS domain by checking if the  map  directory
  11343. is  present. If you are disabling service for some NIS domain, make sure
  11344. to remove the directory as well.
  11345.  
  11346.  
  11347.       Maps are usually stored in DBM files to speed up lookups. They are
  11348. created  from  the  master  files  using  a  program called makedbm (for
  11349. Tobias' server) or dbmload (for Peter's server). These may not be inter-
  11350. changeable.  Transforming a master file into a form parseable by dbmload
  11351. usually requires some awk or sed  magic,  which  tend  to  be  a  little
  11352. tedious  to  type  and  hard  to  remember.  Therefore, Peter Eriksson's
  11353. ypserv package contains a Makefile (called  ypMakefile)  that  does  all
  11354. these jobs for you. You should install it as Makefile in your map direc-
  11355. tory, and edit it to reflect the maps you want  to  distribute.  Towards
  11356. the  top  of  the  file, you find the all target that lists the services
  11357. ypserv is to offer.  By default, the line looks something like this:
  11358.  
  11359.  
  11360.  
  11361.      all: ethers hosts networks protocols rpc services passwd group netid
  11362.  
  11363.  
  11364.  
  11365.  
  11366.        If  you don't want to produce the ethers.byname and ethers.byaddr
  11367. maps, for example, simply remove the ethers prerequisite from this rule.
  11368. To  test  your setup, it may suffice to start with just one or two maps,
  11369. like the services.*  maps.
  11370.  
  11371.  
  11372.      After editing the  Makefile,  while  in  the  map  directory,  type
  11373. ``make''.  This  will  automatically generate and install the maps.  You
  11374. have to make sure to update the maps  whenever  you  change  the  master
  11375. files, otherwise the changes will remain invisible to the network.
  11376.  
  11377.  
  11378.        The  next  section explains how to configure the NIS client code.
  11379. If your setup doesn't work, you should  try  to  find  out  whether  any
  11380. requests  arrive  at  your  server or not. If you specify the -D command
  11381. line flag to the NYS server, it prints debugging messages to the console
  11382. about  all  incoming NIS queries, and the results returned. These should
  11383. give you a hint as to where the problem lies. Tobias' server has no such
  11384. option.
  11385.  
  11386.  
  11387.  
  11388.  
  11389.  
  11390.  
  11391.  
  11392.  
  11393.  
  11394.                            - 173 -
  11395.  
  11396.  
  11397.  
  11398.  
  11399.  
  11400.  
  11401. 11.5  Setting up a NIS Client with NYS
  11402.  
  11403.  
  11404.  
  11405.  
  11406.      Throughout the remainder of this chapter, we will cover the config-
  11407. uration of a NIS client.
  11408.  
  11409.  
  11410.       Your first step should be to tell NYS which server to use for  NIS
  11411. service, setting it in the /etc/yp.conf configuration file.  A very sim-
  11412. ple sample file for a host on the Winery's network may look like this:
  11413.  
  11414.  
  11415.  
  11416.      # yp.conf - YP configuration for NYS library.
  11417.      #
  11418.      domainname winery
  11419.      server vbardolino
  11420.  
  11421.  
  11422.  
  11423.  
  11424.      The  first  statement tells all NIS clients that they belong to the
  11425. winery NIS domain.  If you omit this line, NYS will use the domain  name
  11426. you  assigned  your  system  through the domainname command.  The server
  11427. statement names the NIS server to use.  Of course, the IP address corre-
  11428. sponding to vbardolino must be set in the hosts file; alternatively, you
  11429. may use the IP address itself with the server statement.
  11430.  
  11431.  
  11432.      In the form shown above, the server command tells NYS  to  use  the
  11433. named  server  whatever  the current NIS domain may be. If, however, you
  11434. are moving your machine between different NIS  domains  frequently,  you
  11435. may  want  to  keep information for several domains in the yp.conf file.
  11436. You can have information on the  servers  for  various  NIS  domains  in
  11437. yp.conf  by  adding  the  NIS  domain name to the server statement.  For
  11438. instance, you might change the above sample file for a  laptop  to  look
  11439. like this:
  11440.  
  11441.  
  11442.  
  11443.      # yp.conf - YP configuration for NYS library.
  11444.      #
  11445.      server vbardolino winery
  11446.      server vstout     brewery
  11447.  
  11448.  
  11449.  
  11450.  
  11451.      This allows you to bring up the laptop in any of the two domains by
  11452.  
  11453.  
  11454.  
  11455.  
  11456.  
  11457.  
  11458.  
  11459.  
  11460.                            - 174 -
  11461.  
  11462.  
  11463.  
  11464. simply setting the desired NIS domain at boot time through  the  domain-
  11465. name command.
  11466.  
  11467.  
  11468.       After creating this basic configuration file and making sure it is
  11469. world-readable, you should run your first test to check if you can  con-
  11470. nect  to  your  server.  Make  sure  to  choose any map your server dis-
  11471. tributes, like hosts.byname, and try to retrieve it by using  the  ypcat
  11472. utility.  ypcat, like all other administrative NIS tools, should live in
  11473. /usr/sbin.
  11474.  
  11475.  
  11476.  
  11477.      # ypcat hosts.byname
  11478.      191.72.2.2      vbeaujolais  vbeaujolais.linus.lxnet.org
  11479.      191.72.2.3      vbardolino   vbardolino.linus.lxnet.org
  11480.      191.72.1.1      vlager       vlager.linus.lxnet.org
  11481.      191.72.2.1      vlager       vlager.linus.lxnet.org
  11482.      191.72.1.2      vstout       vstout.linus.lxnet.org
  11483.      191.72.1.3      vale         vale.linus.lxnet.org
  11484.      191.72.2.4      vchianti     vchianti.linus.lxnet.org
  11485.  
  11486.  
  11487.  
  11488.  
  11489.        The output you get should look somthing like that shown above. If
  11490. you get an error message instead that says ``Can't bind to server  which
  11491. serves  domain''  or  something similar, then either the NIS domain name
  11492. you've set doesn't have a matching server defined  in  yp.conf,  or  the
  11493. server  is  unreachable  for  some reason. In the latter case, make sure
  11494. that a ping to the host yields a positive result, and that it is  indeed
  11495. running  a NIS server. You can verify the latter by using rpcinfo, which
  11496. should produce the following output:
  11497.  
  11498.  
  11499.      # rpcinfo -u serverhost ypserv
  11500.      program 100004 version 2 ready and waiting
  11501.  
  11502.  
  11503.  
  11504.  
  11505. 11.6  Choosing the Right Maps
  11506.  
  11507.  
  11508.  
  11509.  
  11510.      Having  made  sure you can reach the NIS server, you have to decide
  11511. which configuration files to replace or augment with NIS maps. Commonly,
  11512. you  will  want use NIS maps for the host and password lookup functions.
  11513. The former is especially useful if you do not run BIND. The latter  per-
  11514. mits  all  users  to  log  into their account from any system in the NIS
  11515. domain; this usually requires sharing a central /home directory  between
  11516. all  hosts  via NFS. It is explained detail in section 11.7 below. Other
  11517. maps, like services.byname, aren't such a dramatic gain,  but  save  you
  11518.  
  11519.  
  11520.  
  11521.  
  11522.  
  11523.  
  11524.  
  11525.  
  11526.                            - 175 -
  11527.  
  11528.  
  11529.  
  11530. some  editing  work  if  you install any network applications that use a
  11531. service name that's not in the standard services file.
  11532.  
  11533.  
  11534.      Generally, you want to have some freedom of choice  when  a  lookup
  11535. function  uses the local files, and when it queries the NIS server.  NYS
  11536. allows you to configure the order in which  a  function  accesses  these
  11537. services.  This is controlled through the /etc/nsswitch.conf file, which
  11538. stands for Name Service Switch but of course isn't limited to  the  name
  11539. service.  For any of the data lookup functions supported by NYS, it con-
  11540. tains a line naming the services to use.
  11541.  
  11542.  
  11543.       The right order of services depends on the type  of  data.  It  is
  11544. unlikely  that  the  services.byname  map will contain entries differing
  11545. from those in the local services file; it may only contain  more.  So  a
  11546. good choice may be to query the local files first, and check NIS only if
  11547. the service name wasn't found. Hostname information, on the other  hand,
  11548. may  change very frequently, so that DNS or the NIS server should always
  11549. have the most accurate account, while the local hosts file is only  kept
  11550. as  a backup if DNS and NIS should fail. In this case, you would want to
  11551. check the local file last.
  11552.  
  11553.  
  11554.      The example below shows how to configure gethostbyname(2), gethost-
  11555. byaddr(2),  and getservbyname(2) functions as described above. They will
  11556. try the listed services in turn; if a lookup  succeeds,  the  result  is
  11557. returned, otherwise the next service is tried.
  11558.  
  11559.  
  11560.  
  11561.      # small sample /etc/nsswitch.conf
  11562.      #
  11563.      hosts:     nis dns files
  11564.      services:  files nis
  11565.  
  11566.  
  11567.  
  11568.  
  11569.      The complete list of services that may be used with an entry in the
  11570. nsswitch.conf  file  is shown below. The actual maps, files, servers and
  11571. objects being queried depend on the entry name.
  11572.  
  11573.  
  11574.  
  11575.  
  11576. nisplus or nis+ Use the NIS+ server for this domain. The location of the
  11577.           server is obtained from the /etc/nis.conf file.
  11578.  
  11579.  
  11580.       nis Use the current NIS server of this domain. The location of the
  11581.           server queried is configured in the yp.conf file as  shown  in
  11582.           the   previous   section.   For  the  hosts  entry,  the  maps
  11583.           hosts.byname and hosts.byaddr are queried.
  11584.  
  11585.  
  11586.  
  11587.  
  11588.  
  11589.  
  11590.  
  11591.  
  11592.                            - 176 -
  11593.  
  11594.  
  11595.  
  11596.       dns Use the DNS name server. This service type is only useful with
  11597.           the hosts entry. The name servers queried are still determined
  11598.           by the standard resolv.conf file.
  11599.  
  11600.  
  11601.     files Use the local file, such as the /etc/hosts file for the  hosts
  11602.           entry.
  11603.  
  11604.  
  11605.       dbm Look  up  the  information from DBM files located in /var/dbm.
  11606.           The name used for the file is that of  the  corresponding  NIS
  11607.           map.
  11608.  
  11609.  
  11610.  
  11611.  
  11612.  
  11613.      Currently, NYS supports the following nsswitch.conf entries: hosts,
  11614. networks, passwd, group, shadow, gshadow, services, protocols, rpc,  and
  11615. ethers. More entries are likely to be added.
  11616.  
  11617.  
  11618.      Figure  11.6 shows a more complete example which introduces another
  11619. feature of nsswitch.conf: the [NOTFOUND=return]  keyword  in  the  hosts
  11620. entry  tells  NYS to return if the desired item couldn't be found in the
  11621. NIS or DNS database.  That is, NYS will continue and  search  the  local
  11622. files  only  if  calls  to the NIS and DNS servers failed for some other
  11623. reason. The local files will then only be used at boot  time  and  as  a
  11624. backup when the NIS server is down.
  11625.  
  11626.  
  11627.  
  11628.  
  11629.  
  11630.  
  11631.  
  11632.  
  11633. 11.7  Using the passwd and group Maps
  11634.  
  11635.  
  11636.  
  11637.  
  11638.      One of the major applications of NIS is in synchronizing  user  and
  11639. account  information on all hosts in a NIS domain. To this end, you usu-
  11640. ally keep only a small local /etc/passwd file, to  which  the  site-wide
  11641. information  from the NIS maps is appended. However, simply enabling NIS
  11642. lookups for this service in nsswitch.conf is not nearly enough.
  11643.  
  11644.  
  11645.      When relying on the password information distributed  by  NIS,  you
  11646. first have to make sure that the numeric user id's of any users you have
  11647. in your local passwd file match the NIS server's idea of user id's.  You
  11648. will  want  this  for  other purposes as well, like mounting NFS volumes
  11649. from other hosts in your network.
  11650.  
  11651.  
  11652.  
  11653.  
  11654.  
  11655.  
  11656.  
  11657.  
  11658.                            - 177 -
  11659.  
  11660.  
  11661.  
  11662.  
  11663.  
  11664.  
  11665.  
  11666.           # /etc/nsswitch.conf
  11667.           #
  11668.           hosts:      nis dns [NOTFOUND=return] files
  11669.           networks:   nis [NOTFOUND=return] files
  11670.  
  11671.           services:   files nis
  11672.           protocols:  files nis
  11673.           rpc:        files nis
  11674.  
  11675.  
  11676.  
  11677.  
  11678.  
  11679.            Figure 17.   Sample nsswitch.conf file.
  11680.  
  11681.      If any of the numeric ids in /etc/passwd or /etc/group deviate from
  11682. those in the maps, you have to adjust file ownerships for all files that
  11683. belong to that user. First you should change all uids and gids in passwd
  11684. and  group  to  the  new  values; then find all files that belong to the
  11685. users just changed, and finally change  their  ownership.   Assume  news
  11686. used  to  have a user id of 9, and okir had a user id of 103, which were
  11687. changed to some other value; you could then  issue  the  following  com-
  11688. mands:
  11689.  
  11690.  
  11691.  
  11692.       # find / -uid   9 -print >/tmp/uid.9
  11693.       # find / -uid 103 -print >/tmp/uid.103
  11694.       # cat /tmp/uid.9   | xargs chown news
  11695.       # cat /tmp/uid.103 | xargs chown okir
  11696.  
  11697.  
  11698.  
  11699.  
  11700.      It is important that you execute these commands with the new passwd
  11701. file  installed,  and  that you collect all file names before you change
  11702. the ownership of any of them. To update the group ownerships  of  files,
  11703. you will use a similar command.
  11704.  
  11705.  
  11706.      Having done this, the numerical uid's and gid's on your system will
  11707. agree with those on all other hosts in your NIS domain.  The  next  step
  11708. will  be  to  add  configuration lines to nsswitch.conf that enables NIS
  11709. lookups for user and group information:
  11710.  
  11711.  
  11712.  
  11713.  
  11714.  
  11715.  
  11716.  
  11717.  
  11718.  
  11719.  
  11720.  
  11721.  
  11722.  
  11723.  
  11724.                            - 178 -
  11725.  
  11726.  
  11727.  
  11728.      # /etc/nsswitch.conf - passwd and group treatment
  11729.      passwd: nis files
  11730.      group:  nis files
  11731.  
  11732.  
  11733.  
  11734.  
  11735.      This  makes  the  login command and all its friends first query the
  11736. NIS maps when a user tries to log in, and if  this  lookup  fails,  fall
  11737. back  to the local files. Usually, you will remove almost all users from
  11738. your local files, and only leave entries for root and  generic  accounts
  11739. like mail in it.  This is because some vital system tasks may require to
  11740. map uids to user names or vice versa.  For example, administrative  cron
  11741. jobs  may execute the su command to temporarily become news, or the UUCP
  11742. subsystem may mail a status report.  If news and uucp don't have entries
  11743. in  the  local  passwd file, these jobs will fail miserably during a NIS
  11744. brownout.
  11745.  
  11746.  
  11747.      There are two big caveats in order here: on one hand, the setup  as
  11748. described  up  to here only works for login suites that don't use shadow
  11749. password, like those included in the util-linux package. The intricacies
  11750. of  using shadow passwords with NIS will be covered below.  On the other
  11751. hand, the login commands are not the only ones that  access  the  passwd
  11752. file  -- look at the ls command which most people use almost constantly.
  11753. Whenever doing a long listing, ls will display the  symbolic  names  for
  11754. user  and  group  owners  of  a  file;  that is, for each uid and gid it
  11755. encounters, it will have to query the NIS server once.  This  will  slow
  11756. things  down  rather  badly  if  your local network is clogged, or, even
  11757. worse, when the NIS server is not on the same physical network, so  that
  11758. datagrams have to pass through a router.
  11759.  
  11760.  
  11761.      Still,  this  is not the whole story yet. Imagine what happens if a
  11762. user wants to change her password.  Usually,  she  will  invoke  passwd,
  11763. which  reads the new password and updates the local passwd file. This is
  11764. impossible with NIS, since that file isn't  available  locally  anymore,
  11765. but  having  users  log into the NIS server whenever they want to change
  11766. their password is not an option either. Therefore, NIS provides a  drop-
  11767. in  replacement  for  passwd  called yppasswd, which does the analoguous
  11768. thing in the presence of NIS. To change the password on the server host,
  11769. it  contacts  the yppasswdd daemon on that host via RPC, and provides it
  11770. with the updated password information.  Usually,  you  install  yppasswd
  11771. over the normal program by doing something like this:
  11772.  
  11773.  
  11774.  
  11775.      # cd /bin
  11776.      # mv passwd passwd.old
  11777.      # ln yppasswd passwd
  11778.  
  11779.  
  11780.  
  11781.  
  11782.  
  11783.  
  11784.  
  11785.  
  11786.  
  11787.  
  11788.  
  11789.  
  11790.                            - 179 -
  11791.  
  11792.  
  11793.  
  11794.      At the same time you have to install rpc.yppasswdd  on  the  server
  11795. and  start it from rc.inet2.  This will effectively hide any of the con-
  11796. tortions of NIS from your users.
  11797.  
  11798.  
  11799.  
  11800.  
  11801.  
  11802. 11.8  Using NIS with Shadow Support
  11803.  
  11804.  
  11805.  
  11806.  
  11807.      There is no NIS support yet for sites that  use  the  shadow  login
  11808. suite.  John F. Haugh, the author of the shadow suite, recently released
  11809. a version of the shadow library functions covered by the GNU Library GPL
  11810. to  comp.sources.misc. It already has some support for NIS, but it isn't
  11811. complete, and the files haven't been added to  the  standard  C  library
  11812. yet.  On the other hand, publishing the information from /etc/shadow via
  11813. NIS kind of defeats the purpose of the shadow suite.
  11814.  
  11815.  
  11816.      Although  the  NYS  password   lookup   functions   don't   use   a
  11817. shadow.byname  map  or  anything  likewise,  NYS  supports using a local
  11818. /etc/shadow file transparently. When the NYS implementation of  getpwnam
  11819. is  called  to  look  up  information related to a given login name, the
  11820. facilities specified by the passwd entry in nsswitch.conf  are  queried.
  11821. The nis service will simply look up the name in the passwd.byname map on
  11822. the NIS server. The files service, however, will check if /etc/shadow is
  11823. present,  and  if so, try to open it. If none is present, or if the user
  11824. doesn't have root privilege, if reverts to the traditional  behavior  of
  11825. looking  up  the  user  information in /etc/passwd only. However, if the
  11826. shadow file exists and can be opened, NYS will extract the user password
  11827. from  shadow. The getpwuid function is implemented accordingly.  In this
  11828. fashion, binaries compiled with NYS will deal with a  local  the  shadow
  11829. suite installation transparently.
  11830.  
  11831.  
  11832. 11.9  Using the Traditional NIS Code
  11833.  
  11834.  
  11835.  
  11836.  
  11837.      If  you are using the client code that is in the standard libc cur-
  11838. rently, configuring a NIS client is a little different. On one hand,  it
  11839. uses a ypbind daemon to broadcast for active servers rather than gather-
  11840. ing this information from a configuration file.  You therefore  have  to
  11841. make sure to start ypbind at boot time. It must be invoked after the NIS
  11842. domain has been set and the RPC portmapper has  been  started.  Invoking
  11843. ypcat to test the server should then work as shown above.
  11844.  
  11845.  
  11846.       Recently, there have been numerous bug reports that NIS fails with
  11847. an error message saying ``clntudp create: RPC: portmapper failure - RPC:
  11848.  
  11849.  
  11850.  
  11851.  
  11852.  
  11853.  
  11854.  
  11855.  
  11856.                            - 180 -
  11857.  
  11858.  
  11859.  
  11860. unable  to receive''. These are due to an incompatible change in the way
  11861. ypbind communicates the binding information to  the  library  functions.
  11862. Obtaining  the latest sources for the NIS utilities and recompiling them
  11863. should cure this problem.(5)
  11864.  
  11865.  
  11866.        Also,  the  way  traditional  NIS decides if and how to merge NIS
  11867. information with that from the local files deviates from  that  used  by
  11868. NYS. For instance, to use the NIS password maps, you have to include the
  11869. following line somewhere in your /etc/passwd map:
  11870.  
  11871.  
  11872.      +:*:0:0:::
  11873.  
  11874.  
  11875.  
  11876.  
  11877.        This  marks  the  place  where  the  password  lookup   functions
  11878. ``insert''  the  NIS maps.  Inserting a similar line (minus the last two
  11879. colons) into /etc/group does the same for the group.* maps.  To use  the
  11880. hosts.*  maps distributed by NIS, change the order line in the host.conf
  11881. file. For instance, if you want to use NIS, DNS, and the /etc/hosts file
  11882. (in that order), you need to change the line to
  11883.  
  11884.  
  11885.      order yp bind hosts
  11886.  
  11887.  
  11888.  
  11889.  
  11890.      The  traditional NIS implementation does not support any other maps
  11891. at the moment.
  11892.  
  11893.  
  11894.  
  11895.  
  11896.  
  11897.  
  11898.  
  11899.  
  11900.  
  11901.  
  11902.  
  11903.  
  11904.  
  11905.  
  11906.  
  11907.  
  11908.  
  11909.  
  11910.  
  11911.  
  11912.  
  11913. 5. The source for  yp-linux  can  be  gotten  from  ftp.uni-
  11914.    paderborn.de in directory /pub/Linux/LOCAL.
  11915.  
  11916.  
  11917.  
  11918.  
  11919.  
  11920.  
  11921.  
  11922.                            - 181 -
  11923.  
  11924.  
  11925.  
  11926. 12.  The Network File System
  11927.  
  11928.  
  11929.  
  11930.  
  11931.      NFS, the network filesystem, is probably the most prominent network
  11932. services using RPC. It allows to access files on remote hosts in exactly
  11933. the same way as a user would access any local files. This is made possi-
  11934. ble  by  a mixture of kernel functionality on the client side (that uses
  11935. the remote file system) and an NFS server on the server side (that  pro-
  11936. vides the file data).  This file access is completely transparent to the
  11937. client, and works across a variety of server and host architectures.
  11938.  
  11939.  
  11940.      NFS offers a number of advantages:
  11941.  
  11942.  
  11943.  
  11944.  
  11945.         + Data accessed by all users can be kept on a central host, with
  11946.           clients mounting this directory at boot time. For example, you
  11947.           can keep all user accounts on one host, and have all hosts  on
  11948.           your  network  mount /home from that host. If installed along-
  11949.           side with NIS, users can then log into any system,  and  still
  11950.           work on one set of files.
  11951.  
  11952.  
  11953.         + Data  consuming  large  amounts of disk space may be kept on a
  11954.           single host.  For example, all files and programs relating  to
  11955.           LaTeX  and METAFONT could be kept and maintained in one place.
  11956.  
  11957.  
  11958.         + Administrative data may be kept on a single host.  No need  to
  11959.           use  rcp anymore to install the same stupid file on 20 differ-
  11960.           ent machines.
  11961.  
  11962.  
  11963.  
  11964.  
  11965.  
  11966.      Linux NFS is largely the work of Rick Sladkey,(1) who wrote the NFS
  11967. kernel  code  and  large  parts of the NFS server. The latter is derived
  11968. from the unfsd user-space NFS server originally written by  Mark  Shand,
  11969. and the hnfs Harris NFS server written by Donald Becker.
  11970.  
  11971.  
  11972.        Let's  have  a look now at how NFS works: A client may request to
  11973. mount a directory from a remote host on a local directory just the  same
  11974. way it can mount a physical device.  However, the syntax used to specify
  11975. the remote directory is different. For example, to mount /home from host
  11976. vlager  to  /users  on vale, the administrator would issue the following
  11977. command on vale:(2)
  11978.  
  11979.  
  11980. 1. Rick can be reached at jrs@world.std.com.
  11981.  
  11982.  
  11983.  
  11984.  
  11985.  
  11986.  
  11987.  
  11988.                            - 182 -
  11989.  
  11990.  
  11991.  
  11992.      # mount -t nfs vlager:/home /users
  11993.  
  11994.  
  11995.  
  11996.  
  11997.      mount will then try to connect to the mountd mount daemon on vlager
  11998. via RPC. The server will check if vale is permitted to mount the  direc-
  11999. tory  in  question, and if so, return it a file handle. This file handle
  12000. will be used in all subsequent requests to files below /users.
  12001.  
  12002.  
  12003.       When someone accesses a file over NFS, the kernel  places  an  RPC
  12004. call to nfsd (the NFS daemon) on the server machine. This call takes the
  12005. file handle, the name of the file to be accessed, and  the  user's  user
  12006. and  group id as parameters. These are used in determining access rights
  12007. to the specified file. In order to prevent unauthorized users from read-
  12008. ing  or  modifying  files,  user  and group ids must be the same on both
  12009. hosts.
  12010.  
  12011.  
  12012.      On most Un*x implementations, the NFS functionality of both  client
  12013. and server are implemented as kernel-level daemons that are started from
  12014. user space at system boot.  These are  the  NFS  daemon  (nfsd)  on  the
  12015. server host, and the Block I/O Daemon (biod) running on the client host.
  12016. To improve throughput, biod performs asynchronous I/O  using  read-ahead
  12017. and  write-behind;  also,  several  nfsd daemons are usually run concur-
  12018. rently.
  12019.  
  12020.  
  12021.      The NFS implementation of Linux is a little different in  that  the
  12022. client code is tightly integrated in the virtual file system (VFS) layer
  12023. of the kernel and doesn't require additional control  through  biod.  On
  12024. the  other  hand,  the  server code runs entirely in user space, so that
  12025. running several copies of the server at the same time is almost impossi-
  12026. ble  because of the synchronization issues this would involve. Linux NFS
  12027. currently also lacks read-ahead and write-behind, but Rick Sladkey plans
  12028. to add this someday.(3)
  12029.  
  12030.  
  12031.       The biggest problem with the Linux NFS code is that the Linux ker-
  12032. nel as of version 1.0 is not able to allocate memory  in  chunks  bigger
  12033. than  4K;  as a consequence, the networking code cannot handle datagrams
  12034. bigger than roughly 3500 bytes after subtracting header sizes etc.  This
  12035. means that transfers to and from NFS daemons running on systems that use
  12036. large UDP datagrams by default (e.g. 8K on SunOS) need to  be  downsized
  12037. artificially. This hurts performance badly under some  circumstances.(4)
  12038. This  limit  is  gone in late Linux-1.1 kernels, and the client code has
  12039. been modified to take advantage of this.
  12040.  
  12041.  
  12042. 2. Note that you can omit the -t nfs argument, because mount
  12043.    sees from the colon that this specifies an NFS volume.
  12044. 3. The  problem  with write-behind is that the kernel buffer
  12045.    cache is indexed by  device/inode  pairs,  and  therefore
  12046.    can't be used for NFS-mounted file systems.
  12047.  
  12048.  
  12049.  
  12050.  
  12051.  
  12052.  
  12053.  
  12054.                            - 183 -
  12055.  
  12056.  
  12057.  
  12058. 12.1  Preparing NFS
  12059.  
  12060. Before you can use NFS, be it as server or client, you  must  make  sure
  12061. your  kernel  has  NFS support compiled in.  Newer kernels have a simple
  12062. interface on the proc filesystem for this, the  /proc/filesystems  file,
  12063. which you can display using cat:
  12064.  
  12065.  
  12066.  
  12067.      $ cat /proc/filesystems
  12068.              minix
  12069.              ext2
  12070.              msdos
  12071.      nodev   proc
  12072.      nodev   nfs
  12073.  
  12074.  
  12075.  
  12076.  
  12077.      If nfs is missing from this list, then you have to compile your own
  12078. kernel with NFS enabled.  Configuring  the  kernel  network  options  is
  12079. explained in section ``Kernel Configuration'' in chapter 4..
  12080.  
  12081.  
  12082.      For  older  kernels prior to Linux 1.1, the easiest way to find out
  12083. whether your kernel has NFS support enabled is to actually try to  mount
  12084. an  NFS  file system. For this, you could create a directory below /tmp,
  12085. and try to mount a local directory on it:
  12086.  
  12087.  
  12088.      # mkdir /tmp/test
  12089.      # mount localhost:/etc /tmp/test
  12090.  
  12091.  
  12092.  
  12093.  
  12094.      If  this mount attempt fails with an error message saying ``fs type
  12095. nfs no supported by kernel'', you  must  make  a  new  kernel  with  NFS
  12096. enabled.   Any  other  error  messages  are  completely harmless, as you
  12097. haven't configured the NFS daemons on your host yet.
  12098.  
  12099.  
  12100. 12.2  Mounting an NFS Volume
  12101.  
  12102.  
  12103.  
  12104.  
  12105.  
  12106.  
  12107. 4. As  explained  to  me  by Alan Cox: The NFS specification
  12108.    requires the server to flush each write to disk before it
  12109.    returns  an  acknowledgement.  As  BSD  kernels  are only
  12110.    capable of page-sized writes (4K), writing a 4 chunks  of
  12111.    1K  each  to  a  BSD-based  NFS server results in 4 write
  12112.    operations of 4K each.
  12113.  
  12114.  
  12115.  
  12116.  
  12117.  
  12118.  
  12119.  
  12120.                            - 184 -
  12121.  
  12122.  
  12123.  
  12124.      NFS volumes(5) are mounted very much the way usual file systems are
  12125. mounted. You invoke mount using the following syntax:
  12126.  
  12127.  
  12128.      # mount -t nfs nfs volume local dir options
  12129.  
  12130.  
  12131.  
  12132.  
  12133.      nfs volume is given as remote host:remote dir.  Since this notation
  12134. is unique to NFS file systems, you can leave out the -t nfs option.
  12135.  
  12136.  
  12137.        There  are a number of additional options that you may specify to
  12138. mount upon mounting an NFS volume. These may either be  given  following
  12139. the  -o  switch  on  the  command  line,  or in the options field of the
  12140. /etc/fstab entry for the volume. In both  cases,  multiple  options  are
  12141. separated  from  each  other by commas. Options specified on the command
  12142. line always override those given in the fstab file.
  12143.  
  12144.  
  12145.      A sample entry in /etc/fstab might be
  12146.  
  12147.  
  12148.  
  12149.      # volume              mount point       type  options
  12150.      news:/usr/spool/news  /usr/spool/news   nfs   timeo=14,intr
  12151.  
  12152.  
  12153.  
  12154.  
  12155.      This volume may then be mounted using
  12156.  
  12157.  
  12158.      # mount news:/usr/spool/news
  12159.  
  12160.  
  12161.  
  12162.  
  12163.      In the absence of a fstab entry, NFS mount invocations look  a  lot
  12164. uglier.  For  instance,  suppose  you mount your users' home directories
  12165. from a machine named moonshot, which uses a default block size of 4K for
  12166. read/write  operations.  You  might  decrease  block  size to 2K to suit
  12167. Linux' datagram size limit by issuing
  12168.  
  12169.  
  12170.      # mount moonshot:/home /home -o rsize=2048,wsize=2048
  12171.  
  12172.  
  12173.  
  12174.  
  12175.  
  12176.  
  12177. 5. One doesn't say file system, because these are not proper
  12178.    file systems.
  12179.  
  12180.  
  12181.  
  12182.  
  12183.  
  12184.  
  12185.  
  12186.                            - 185 -
  12187.  
  12188.  
  12189.  
  12190.        The list of all valid options is described in its entirety in the
  12191. nfs(5) manual page that comes with Rick Sladkey's NFS-aware  mount  tool
  12192. which can be found in Rik Faith's util-linux package).  The following is
  12193. an incomplete list of those you would probably want to use:
  12194.  
  12195.  
  12196.  
  12197.  
  12198. rsize=n and wsize=n These specify the datagram  size  used  by  the  NFS
  12199.           clients  on  read  and write requests, respectively. They cur-
  12200.           rently default to 1024 bytes, due to the limit on UDP datagram
  12201.           size described above.
  12202.  
  12203.  
  12204.   timeo=n This sets the time (in tenths of a second) the NFS client will
  12205.           wait for a request to complete. The default values is 0.7 sec-
  12206.           onds.
  12207.  
  12208.  
  12209.      hard Explicitly  mark  this  volume  as hard-mounted. This is on by
  12210.           default.
  12211.  
  12212.  
  12213.      soft Soft-mount the driver (as opposed to hard-mount).
  12214.  
  12215.  
  12216.      intr Allow signals to interrupt an NFS call.  Useful  for  aborting
  12217.           when the server doesn't respond.
  12218.  
  12219.  
  12220.  
  12221.  
  12222.  
  12223.      Except  for  rsize  and  wsize,  all  of these options apply to the
  12224. client's behavior if the server should become inaccessible  temporarily.
  12225. They  play  together  in  the following way: whenever the client sends a
  12226. request to the NFS server, it expects the  operation  to  have  finished
  12227. after  a given interval (specified in the timeout option). If no confir-
  12228. mation is received within this time, a so-called minor  timeout  occurs,
  12229. and  the  operation  is retried with the timeout interval doubled. After
  12230. reaching a maximum timeout of 60 seconds, a major timeout occurs.
  12231.  
  12232.  
  12233.       By default, a major timeout will cause the client to print a  mes-
  12234. sage  to the console and start all over again, this time with an initial
  12235. timeout interval twice that of the previous cascade.  Potentially,  this
  12236. may  go on forever. Volumes that stubbornly retry an operation until the
  12237. server becomes available again are  called  hard-mounted.  The  opposite
  12238. variety,  soft-mounted  volumes  gerenates  an I/O error for the calling
  12239. process whenever a major timeout occurs.  Because  of  the  write-behind
  12240. introduced  by  the buffer cache, this error condition is not propagated
  12241. to the process itself before it calls the  write(2)  function  the  next
  12242. time,  so  a program can never be sure that a write operation to a soft-
  12243. mounted volume has succeded at all.
  12244.  
  12245.  
  12246.  
  12247.  
  12248.  
  12249.  
  12250.  
  12251.  
  12252.                            - 186 -
  12253.  
  12254.  
  12255.  
  12256.      Whether you hard- or soft-mount a volume is not simply  a  question
  12257. of  taste,  but also has to do with what sort of information you want to
  12258. access from this volume. For example, if you mount your  X  programs  by
  12259. NFS,  you  certainly  would  not  want your X session to go berserk just
  12260. because someone brought the network to a  grinding  halt  by  firing  up
  12261. seven copies of xv at the same time, or by pulling the Ethernet plug for
  12262. a moment.  By hard-mounting these, you make sure that your computer will
  12263. wait  until it is able to re-establish contact with your NFS-server.  On
  12264. the other hand, non-critical data such as NFS-mounted  news  partititons
  12265. or  FTP  archives  may  as well be soft-mounted, so it doesn't hang your
  12266. session in case the remote machine should be temporarily unreachable, or
  12267. down. If your network connection to the server is flakey or goes through
  12268. a loaded router, you may either increase the initial timeout  using  the
  12269. timeo  option,  or  hard-mount the volumes, but allow for signals inter-
  12270. rupting the NFS call so that  you  may  still  abort  any  hanging  file
  12271. access.
  12272.  
  12273.  
  12274.      Usually,  the mountd daemon will in some way or other keep track of
  12275. which directories have been mounted by what hosts. This information  can
  12276. be  displayed using the showmount program, which is also included in the
  12277. NFS server package. The Linux mountd, however, does not do this yet.
  12278.  
  12279.  
  12280. 12.3  The NFS Daemons
  12281.  
  12282.  
  12283.  
  12284.  
  12285.      If you want to provide NFS service to other hosts, you have to  run
  12286. the  nfsd  and  mountd  daemons on your machine.  As RPC-based programs,
  12287. they are not managed by inetd, but are started up at boot time, and reg-
  12288. ister  themselves  with the portmapper. Therefore, you have to make sure
  12289. to start them only after rpc.portmap is running.  Usually,  you  include
  12290. the following two lines in your rc.inet2 script:
  12291.  
  12292.  
  12293.  
  12294.      if [ -x /usr/sbin/rpc.mountd ]; then
  12295.              /usr/sbin/rpc.mountd; echo -n " mountd"
  12296.      fi
  12297.      if [ -x /usr/sbin/rpc.nfsd ]; then
  12298.              /usr/sbin/rpc.nfsd; echo -n " nfsd"
  12299.      fi
  12300.  
  12301.  
  12302.  
  12303.  
  12304.       The ownership information of files a NFS daemon  provides  to  its
  12305. clients  usually  contains  only numerical user and group id's.  If both
  12306. client and server associate the same user and  group  names  with  these
  12307. numerical id's, they are said to share the same uid/gid space. For exam-
  12308. ple, this is the case when you use NIS to distribute the passwd informa-
  12309. tion to all hosts on your LAN.
  12310.  
  12311.  
  12312.  
  12313.  
  12314.  
  12315.  
  12316.  
  12317.  
  12318.                            - 187 -
  12319.  
  12320.  
  12321.  
  12322.      On  some occasions, however, they do not match. Rather updating the
  12323. uid's and gid's of the client to match those of the server, you can  use
  12324. the  ugidd  mapping  daemon  to  work  around this. Using the map daemon
  12325. option explained below, you can tell nfsd to map  the  server's  uid/gid
  12326. space  to  the  client's  uid/gid space with the aid of the ugidd on the
  12327. client.
  12328.  
  12329.  
  12330.      ugidd is an RPC-based server, and is  started  from  rc.inet2  just
  12331. like nfsd and mountd.
  12332.  
  12333.  
  12334.  
  12335.      if [ -x /usr/sbin/rpc.ugidd ]; then
  12336.              /usr/sbin/rpc.ugidd; echo -n " ugidd"
  12337.      fi
  12338.  
  12339.  
  12340.  
  12341.  
  12342. 12.4  The exports File
  12343.  
  12344.  
  12345.  
  12346.  
  12347.      While  the above options applied to the client's NFS configuration,
  12348. there is a different set of options on the server  side  that  configure
  12349. its  per-client  behavior. These options must be set in the /etc/exports
  12350. file.
  12351.  
  12352.  
  12353.      By default, mountd will not allow anyone to mount directories  from
  12354. the  local  host,  which is a rather sensible attitude. To permit one or
  12355. more hosts to NFS-mount a directory, it must exported, that is, must  be
  12356. specified in the exports file. A sample file may look like this:
  12357.  
  12358.  
  12359.  
  12360.      # exports file for vlager
  12361.      /home             vale(rw) vstout(rw) vlight(rw)
  12362.      /usr/X386         vale(ro) vstout(ro) vlight(ro)
  12363.      /usr/TeX          vale(ro) vstout(ro) vlight(ro)
  12364.      /                 vale(rw,no root squash)
  12365.      /home/ftp         (ro)
  12366.  
  12367.  
  12368.  
  12369.  
  12370.      Each  line  defines a directory, and the hosts allowed to mount it.
  12371. A host name is usually a fully qualified domain name, but may  addition-
  12372. ally  contain  the  * and ? wildcard, which act the way they do with the
  12373. Bourne shell. For instance, lab*.foo.com matches lab01.foo.com  as  well
  12374. as  laber.foo.com.   If  no  host  name  is given, as with the /home/ftp
  12375. directory in the example above,  any  host  is  allowed  to  mount  this
  12376.  
  12377.  
  12378.  
  12379.  
  12380.  
  12381.  
  12382.  
  12383.  
  12384.                            - 188 -
  12385.  
  12386.  
  12387.  
  12388. directory.
  12389.  
  12390.  
  12391.      When  checking  a client host against the exports file, mountd will
  12392. look up the client's hostname using the gethostbyaddr(2) call. With DNS,
  12393. this call returns the client's canonical hostname, so you must make sure
  12394. not to use aliases in exports.  Without using DNS, the returned name  is
  12395. the  first  hostname  found  in the hosts file that matches the client's
  12396. address.
  12397.  
  12398.  
  12399.      The host name is followed by an optional, comma-separated  list  of
  12400. flags, enclosed in brackets. These flags may take the following values:
  12401.  
  12402.  
  12403.  
  12404.  
  12405.  insecure Permit non-authenticated access from this machine.
  12406.  
  12407.  
  12408.  unix-rpc Require  UNIX-domain  RPC  authentication  from  this machine.
  12409.           This simply requires that requests originate from  a  reserved
  12410.           internet port (i.e. the port number has to be less than 1024).
  12411.           This option is on by default.
  12412.  
  12413.  
  12414. secure-rpc Require secure RPC authentication from this machine. This has
  12415.           not  been  implemented  yet. See Sun's documentation on Secure
  12416.           RPC.
  12417.  
  12418.  
  12419.  kerberos Require Kerberos authentication on accesses from this machine.
  12420.           This  has not been implemented yet.  See the MIT documentation
  12421.           on the Kerberos authentication system.
  12422.  
  12423.  
  12424. root squash  This is a security feature that denies the  super  user  on
  12425.           the  specified  hosts  any  special  access  rights by mapping
  12426.           requests from uid 0 on the client to uid  65534  (-2)  on  the
  12427.           server.  This uid should be associated with the user nobody.
  12428.  
  12429.  
  12430. no root squash Don't  map  requests  from  uid  0.  This option is on by
  12431.           default.
  12432.  
  12433.  
  12434.        ro  Mount  file  hierarchy  read-only.   This  option  is  on  by
  12435.           default.
  12436.  
  12437.  
  12438.        rw Mount file hierarchy read-write.
  12439.  
  12440.  
  12441.  
  12442.  
  12443.  
  12444.  
  12445.  
  12446.  
  12447.  
  12448.  
  12449.  
  12450.                            - 189 -
  12451.  
  12452.  
  12453.  
  12454. link relative Convert  absolute  symbolic links (where the link contents
  12455.           start with a slash) into relative links by prepending the nec-
  12456.           essary  number  of  ../'s to get from the directory containing
  12457.           the link to the root on the server.  This  option  only  makes
  12458.           sense  when  a host's entire file system is mounted, else some
  12459.           of the links might point to nowhere, or even worse, files they
  12460.           were never meant to point to.
  12461.  
  12462.  
  12463.                This option is on by default.
  12464.  
  12465.  
  12466. link absolute Leave  all  symbolic link as they are (the normal behavior
  12467.           for Sun-supplied NFS servers).
  12468.  
  12469.  
  12470. map identity  The map identity option tells the server  to  assume  that
  12471.           the  client uses the same uid's and gid's as the server.  This
  12472.           option is on by default.
  12473.  
  12474.  
  12475. map daemon This option tells the NFS server to assume  that  client  and
  12476.           server  do  not  share the same uid/gid space.  nfsd will then
  12477.           build a list mapping id's between client and server by  query-
  12478.           ing the client's ugidd daemon.
  12479.  
  12480.  
  12481.  
  12482.  
  12483.  
  12484.        An error parsing the exports file is reported to syslogd's daemon
  12485. facility at level notice whenever nfsd or mountd is started up.
  12486.  
  12487.  
  12488.      Note that host names are obtained from the client's IP  address  by
  12489. reverse  mapping,  so you have to have the resolver configured properly.
  12490. If you use BIND and are very security-conscious, you should enable spoof
  12491. checking in your host.conf file.
  12492.  
  12493.  
  12494. 12.5  The Linux Automounter
  12495.  
  12496.  
  12497.  
  12498.  
  12499.      Sometimes, it is wasteful to mount all NFS volumes users might pos-
  12500. sibly want to access; either because of the sheer number of  volumes  to
  12501. be  mounted, or because of the time this would take at startup. A viable
  12502. alternative to this is a so-called automounter. This is  a  daemon  that
  12503. automatically  and  transparently  mounts  any NFS volume as needed, and
  12504. unmounts them after they have not been used for some time.  One  of  the
  12505. clever things about an automounter is that it is able to mount a certain
  12506. volume from alternative places.  For instance, you may  keep  copies  of
  12507. your  X  programs  and support files on two or three hosts, and have all
  12508.  
  12509.  
  12510.  
  12511.  
  12512.  
  12513.  
  12514.  
  12515.  
  12516.                            - 190 -
  12517.  
  12518.  
  12519.  
  12520. other hosts mount them via NFS.  Using an automounter, you  may  specify
  12521. all  three of them to be mounted on /usr/X386; the automounter will then
  12522. try to mount any of these until one of the mount attempts succeeds.
  12523.  
  12524.  
  12525.      The automounter commonly used with Linux  is  called  amd.  It  was
  12526. originally  written  by Jan-Simon Pendry and has been ported to Linux by
  12527. Rick Sladkey. The current version is amd-5.3.
  12528.  
  12529.  
  12530.      Explaining amd is beyond the scope of this chapter; for a good man-
  12531. ual  please  refer to the sources; they contain a texinfo file with very
  12532. detailed information.
  12533.  
  12534.  
  12535.  
  12536.  
  12537.  
  12538.  
  12539.  
  12540.  
  12541.  
  12542.  
  12543.  
  12544.  
  12545.  
  12546.  
  12547.  
  12548.  
  12549.  
  12550.  
  12551.  
  12552.  
  12553.  
  12554.  
  12555.  
  12556.  
  12557.  
  12558.  
  12559.  
  12560.  
  12561.  
  12562.  
  12563.  
  12564.  
  12565.  
  12566.  
  12567.  
  12568.  
  12569.  
  12570.  
  12571.  
  12572.  
  12573.  
  12574.  
  12575.  
  12576.  
  12577.  
  12578.  
  12579.  
  12580.  
  12581.  
  12582.                            - 191 -
  12583.  
  12584.  
  12585.  
  12586. 13.  Managing Taylor UUCP
  12587.  
  12588.  
  12589.  
  12590.  
  12591. 13.1  History
  12592.  
  12593. UUCP was designed in the late seventies by Mike Lesk at AT&T Bell  Labo-
  12594. ratories  to  provide  a  simple  dial-up  network over public telephone
  12595. lines. Since most people that want to have  email  and  Usenet  News  on
  12596. their  home  machine still communicate through modems, UUCP has remained
  12597. very popular.  Although there are many implementations running on a wide
  12598. variety of hardware platforms and operating systems, they are compatible
  12599. to a high degree.
  12600.  
  12601.  
  12602.      However, as with most software that has somehow become ``standard''
  12603. over  the years, there is no UUCP which one would call the UUCP.  It has
  12604. undergone a steady process of evolution since the  first  version  which
  12605. was  implemented  in 1976.  Currently, there are two major species which
  12606. differ mainly in their support of hardware and their configuration.   Of
  12607. these,  various  implementations  exist,  each varying slightly from its
  12608. siblings.
  12609.  
  12610.  
  12611.       One species is the so-called ``Version 2 UUCP'', which dates  back
  12612. to  a  1977 implementation by Mike Lesk, David A. Novitz, and Greg Ches-
  12613. son.  Although it is fairly old, it is still  in  frequent  use.  Recent
  12614. implementations  of  Version  2 provide much of the comfort of the newer
  12615. UUCP species.
  12616.  
  12617.  
  12618.       The second species was developed in 1983, and is commonly referred
  12619. to  as  BNU  (Basic  Networking Utilities), HoneyDanBer UUCP, or HDB for
  12620. short.  The name is derived from the authors' names, P. Honeyman, D.  A.
  12621. Novitz,  and  B. E. Redman.  HDB was conceived to eliminate some of Ver-
  12622. sion 2 UUCP's deficiencies.  For example, new  transfer  protocols  were
  12623. added, and the spool directory was split so that now there is one direc-
  12624. tory for each site you have UUCP traffic with.
  12625.  
  12626.  
  12627.       The implementation of UUCP currently  distributed  with  Linux  is
  12628. Taylor  UUCP  1.04,(1)  which is the version this chapter is based upon.
  12629. Taylor UUCP Version 1.04 was released in February 1993.  Apart from tra-
  12630. ditional configuration files, Taylor UUCP may also be compiled to under-
  12631. stand the new-style -- a.k.a. ``Taylor'' -- configuration files.
  12632.  
  12633.  
  12634.      Version 1.05 has been released recently, and will soon make its way
  12635. into  most  distributions. The differences between these versions mostly
  12636. affect features you will never use, so you should be able  to  configure
  12637. Taylor UUCP 1.05 using the information form this book.
  12638.  
  12639.  
  12640. 1. Written and copyrighted by Ian Taylor, 1993.
  12641.  
  12642.  
  12643.  
  12644.  
  12645.  
  12646.  
  12647.  
  12648.                            - 192 -
  12649.  
  12650.  
  12651.  
  12652.      As  included  in  most  Linux distributions, Taylor UUCP is usually
  12653. compiled for BNU compatibility, or the Taylor configuiration scheme,  or
  12654. both.   As  the  latter  is  much  more flexible, and probably easier to
  12655. understand than the often rather obscure BNU configuration files, I will
  12656. describe the Taylor scheme below.
  12657.  
  12658.  
  12659.      The  purpose  of  this  chapter  is  not  to give you an exhaustive
  12660. description of what the command line options for the UUCP  commands  are
  12661. and  what  they  do,  but to give you an introduction on how to set up a
  12662. working UUCP node.  The first section gives a hopefully gentle introduc-
  12663. tion  about  how UUCP implements remote execution and file transfers. If
  12664. you are not entirely new to UUCP, you might want to skip this  and  move
  12665. on  to  section  13.3,  which  explains the various files used to set up
  12666. UUCP.
  12667.  
  12668.  
  12669.      We will however assume that you are familiar with the user programs
  12670. of  the  UUCP  suite.  These are uucp and uux. For a description, please
  12671. refer to the on-line manual pages.
  12672.  
  12673.  
  12674.      Besides the publicly accessible programs, uux and  uucp,  the  UUCP
  12675. suite  contains  a  number  of commands used for administrative purposes
  12676. only. They are used to monitor UUCP traffic across your node, remove old
  12677. log  files, or compile statistics. None of these will be described here,
  12678. because they're peripheral to the main tasks of UUCP.  Besides,  they're
  12679. well  documented  and  fairly  easy  to understand.  However, there is a
  12680. third category, which comprises the actual UUCP ``work  horses''.   They
  12681. are  called  uucico (where cico stands for copy-in copy-out), and uuxqt,
  12682. which executes jobs sent from remote systems.
  12683.  
  12684.  
  12685. 13.1.1  More Information on UUCP
  12686.  
  12687. Those who don't find everything they need in this  chapter  should  read
  12688. the  documentation  that comes along with the package.  This is a set of
  12689. texinfo files that describe the setup  using  the  Taylor  configuration
  12690. scheme.  Texinfo can be converted to DVI and to GNU info files using tex
  12691. and makeinfo, respectively.
  12692.  
  12693.  
  12694.       If you want to use BNU or even (shudder!) Version 2  configuration
  12695. files,  there is a very good book, ``Managing UUCP and Usenet'' ([ GETST
  12696. "reilly-uucp" ]).  I find it very useful. Another good source for infor-
  12697. mation about UUCP on Linux is Vince Skahan's UUCP-HOWTO, which is posted
  12698. regularly to comp.os.linux.announce.
  12699.  
  12700.  
  12701.      There's also  a  newsgroup  for  the  discussion  of  UUCP,  called
  12702. comp.mail.uucp.   If you have questions specific to Taylor UUCP, you may
  12703. be better off asking  them  there,  rather  than  on  the  comp.os.linux
  12704. groups.
  12705.  
  12706.  
  12707.  
  12708.  
  12709.  
  12710.  
  12711.  
  12712.  
  12713.  
  12714.                            - 193 -
  12715.  
  12716.  
  12717.  
  12718. 13.2  Introduction
  12719.  
  12720. 13.2.1  Layout of UUCP Transfers and Remote Execution
  12721.  
  12722.   Vital  to  the  understanding  of  UUCP is the concept of jobs.  Every
  12723. transfer a user initiates with uucp or uux is called a job. It  is  made
  12724. up  of  a command to be executed on a remote system, and a collection of
  12725. files to be transferred between sites. One of these parts may  be  miss-
  12726. ing.
  12727.  
  12728.  
  12729.      As  an  example,  assume  you  issued the following command on your
  12730. host, which makes UUCP copy the file  netguide.ps  to  host  pablo,  and
  12731. makes it execute the lpr command to print the file.
  12732.  
  12733.  
  12734.  
  12735.      $ uux -r pablo!lpr !netguide.ps
  12736.  
  12737.  
  12738.  
  12739.  
  12740.       UUCP does not generally call the remote system immediately to exe-
  12741. cute a job (else you could make do with kermit). Instead, it temporarily
  12742. stores the job description away. This is called spooling.  The directory
  12743. tree under which jobs are stored is therefore called the spool directory
  12744. and  is  generally  located in /var/spool/uucp.  In our example, the job
  12745. description would contain information about the  remote  command  to  be
  12746. executed  (lpr),  the  user who requested the execution, and a couple of
  12747. other items.  In addition to the job description, UUCP has to store  the
  12748. input file, netguide.ps.
  12749.  
  12750.  
  12751.      The exact location and naming of spool files may vary, depending on
  12752. some compile-time options. HDB-compatible UUCP's generally  store  spool
  12753. files  in a directory named /var/spool/uucp/site, where site is the name
  12754. of the remote site. When compiled for Taylor  configuration,  UUCP  will
  12755. create  subdirectories  below the site-specific spool directory for dif-
  12756. ferent types of spool files.
  12757.  
  12758.  
  12759.      At regular intervals, UUCP dials up the remote system.  When a con-
  12760. nection  to  the remote machine is established, UUCP transfers the files
  12761. describing the job, plus any input files.  The incoming jobs will not be
  12762. executed  immediately, but only after the connection terminates. This is
  12763. done by uuxqt, which also takes care of forwarding any jobs if they  are
  12764. designated for another site.
  12765.  
  12766.  
  12767.        To  distinguish  between  important and less important jobs, UUCP
  12768. associates a grade with each job. This is a single letter, ranging  from
  12769. 0  through  9,  A  though  Z, and a through z, in decreasing precedence.
  12770. Mail is customarily spooled with grade B or C,  while  news  is  spooled
  12771. with  grade  N.   Jobs with higher grade are transferred earlier. Grades
  12772.  
  12773.  
  12774.  
  12775.  
  12776.  
  12777.  
  12778.  
  12779.  
  12780.                            - 194 -
  12781.  
  12782.  
  12783.  
  12784. may be assigned using the -g flag when invoking uucp or uux.
  12785.  
  12786.  
  12787.      You can also disallow the transfer of jobs below a given  grade  at
  12788. certain times.  This is also called the maximum spool grade allowed dur-
  12789. ing a conversation and defaults to z. Note the terminological  ambiguity
  12790. here:  a  file  is  transferred only if it is equal or above the maximum
  12791. spool grade.
  12792.  
  12793.  
  12794. 13.2.2  The Inner Workings of uucico
  12795.  
  12796.  
  12797.  
  12798.  
  12799. <>         To understand why uucico needs to  know  certain  things,  a  quick
  12800.       description  of  how it actually connects to a remote system might be in
  12801.       order here.
  12802.  
  12803.  
  12804.            When you execute uucico -s system from the command line,  it  first
  12805.       has  to connect physically. The actions taken depend on the type of con-
  12806.       nection to open -- e.g. when using telephone line,  it  has  to  find  a
  12807.       modem,  and  dial out. Over TCP, it has to call gethostbyname(3) to con-
  12808.       vert the name to a network address, find out which  port  to  open,  and
  12809.       bind the address to the corresponding socket.
  12810.  
  12811.  
  12812.              After this connection has been established, an authorization pro-
  12813.       cedure has to be passed. It generally consists of the remote system ask-
  12814.       ing  for  a login name, and possibly a password. This is commonly called
  12815.       the login chat. The authorization procedure is performed either  by  the
  12816.       usual  getty/login  suite, or -- on TCP sockets -- by uucico itself.  If
  12817.       authorization succeeds, the remote end fires up uucico. The  local  copy
  12818.       of  uucico  which initiated the connection is referred to as master, the
  12819.       remote copy as slave.
  12820.  
  12821.  
  12822.             Next follows the handshake phase: the master now sends  its  host-
  12823.       name, plus several flags.  The slave checks this hostname for permission
  12824.       to log in, send and receive files, etc.  The flags describe (among other
  12825.       things) the maximum grade of spool files to transfer. If enabled, a con-
  12826.       versation count, or call sequence number check takes  place  here.  With
  12827.       this  feature,  both  sites  maintain a count of successful connections,
  12828.       which are compared. If they do not match, the handshake fails.  This  is
  12829.       useful to protect yourself against impostors.
  12830.  
  12831.  
  12832.            Finally,  the two uucico's try to agree on a common transfer proto-
  12833.       col. This protocol governs the way data is transferred, checked for con-
  12834.       sistency,  and  retransmitted  in  case of an error. There is a need for
  12835.       different protocols because of the differing types of  connections  sup-
  12836.       ported.  For  example, telephone lines require a ``safe'' protocol which
  12837.       is pessimistic  about  errors,  while  TCP  transmission  is  inherently
  12838.  
  12839.  
  12840.  
  12841.  
  12842.  
  12843.  
  12844.  
  12845.  
  12846.                                  - 195 -
  12847.  
  12848.  
  12849.  
  12850.       reliable  and can use a more efficient protocol that foregoes most extra
  12851.       error checking.
  12852.  
  12853.  
  12854.            After the handshake is  complete,  the  actual  transmission  phase
  12855.       begins.   Both  ends  turn  on the selected protocol driver. The drivers
  12856.       possibly perform a protocol-specific initialization sequence.
  12857.  
  12858.  
  12859.            First, the master sends all files  queued  for  the  remote  system
  12860.       whose  spool  grade is high enough. When it has finished, it informs the
  12861.       slave that it is done, and that the slave may now hang up. The slave now
  12862.       can  either  agree to hang up, or take over the conversation.  This is a
  12863.       change of roles: now the remote system becomes master, and the local one
  12864.       becomes  slave.  The  new  master  now sends its files.  When done, both
  12865.       uucico's exchange termination messages, and close the connection.
  12866.  
  12867.  
  12868.            We will not go into this in greater detail: please refer to  either
  12869.       the  sources  or  any good book on UUCP for this. There is also a really
  12870.       antique article floating around the net, written  by  David  A.  Novitz,
  12871.       which  gives  a  detailed  description of the UUCP protocol.  The Taylor
  12872.       UUCP FAQ also disucsses some details of the way UUCP is implemented.  It
  12873.       is posted to comp.mail.uucp regularly.
  12874.  
  12875.  
  12876.       13.2.3  uucico Command Line Options
  12877.  
  12878.  
  12879.  
  12880.  
  12881.            This  section describes the most important command line options for
  12882.       uucico.  For a complete list, please refer to the uucico(1) manual page.
  12883.  
  12884.  
  12885.  
  12886.  
  12887.       -s system Call  the named system unless prohibited by call time restric-
  12888.                 tions.
  12889.  
  12890.  
  12891.       -S system Call the named system unconditionally.
  12892.  
  12893.  
  12894.             -r1 Start uucico in master mode. This is the default when -s or -S
  12895.                 is  given.  All by itself, the -r1 option causes uucico to try
  12896.                 to call all systems in sys, unless prohibited by call or retry
  12897.                 time restrictions.
  12898.  
  12899.  
  12900.             -r0 Start  uucico in slave mode. This is the default when no -s or
  12901.                 -S is given.  In slave mode, either standard input/output  are
  12902.                 assumed  to  be  connected  to  a serial port, or the TCP port
  12903.                 specified by the -p option is used.
  12904.  
  12905.  
  12906.  
  12907.  
  12908.  
  12909.  
  12910.  
  12911.  
  12912.                                  - 196 -
  12913.  
  12914.  
  12915.  
  12916.       -x type, -X type Turn on debugging of the specified type. Several  types
  12917.                 may  be  given  as a comma-separated list. The following types
  12918.                 are valid: abnormal, chat, handshake, uucp-proto, proto, port,
  12919.                 config, spooldir, execute, incoming, outgoing. Using all turns
  12920.                 on all options.  For compatibility with other UUCP implementa-
  12921.                 tions,  a  number  may  be  specified  instead, which turns on
  12922.                 debugging for the first n items from the above list.
  12923.  
  12924.  
  12925.                      Debugging messages will be logged to the file Debug below
  12926.                 /var/spool/uucp.
  12927.  
  12928.  
  12929.  
  12930.  
  12931.  
  12932.  
  12933.  
  12934.  
  12935.       13.3  UUCP Configuration Files
  12936.  
  12937.       In  contrast  to simpler file transfer programs, UUCP was designed to be
  12938.       able to handle all transfers automatically. Once it is set up  properly,
  12939.       interference  by  the administrator should not be necessary on a day-to-
  12940.       day basis. The information required for this is is kept in a  couple  of
  12941.       configuration  files that reside in the directory /usr/lib/uucp. Most of
  12942.       these files are used only when dialing out.
  12943.  
  12944.  
  12945.       13.3.1  A Gentle Introduction to Taylor UUCP
  12946.  
  12947.  
  12948.  
  12949.  
  12950.            To say that UUCP configuration is hard would be an  understatement.
  12951.       It is really a hairy subject, and the sometimes terse format of the con-
  12952.       figuration files doesn't make things easier (although the Talyor  format
  12953.       is  almost  easy reading compared to the older formats in HDB or Version
  12954.       2).
  12955.  
  12956.  
  12957.            To give you a feel how all these files interact, we will  introduce
  12958.       you  to  the  most  important ones, and have a look at sample entries of
  12959.       these files. We won't explain everything in detail now; a more  accurate
  12960.       account  is given in separate sections below. If you want to set up your
  12961.       machine for UUCP, you had best start with some sample files,  and  adapt
  12962.       them  gradually.   You  can  pick  either  those  shown  below, or those
  12963.       included in your favorite Linux distribution.
  12964.  
  12965.  
  12966.            All files described in this section are kept in /usr/lib/uucp or  a
  12967.       subdirectory  thereof.  Some  Linux  distributions contain UUCP binaries
  12968.       that have support for both HDB and Taylor configuration enabled, and use
  12969.       different  subdirectories  for  each  configuration file set. There will
  12970.  
  12971.  
  12972.  
  12973.  
  12974.  
  12975.  
  12976.  
  12977.  
  12978.                                  - 197 -
  12979.  
  12980.  
  12981.  
  12982.       usually be a README file in /usr/lib/uucp.
  12983.  
  12984.  
  12985.            For UUCP to work properly, these files must be owned  by  the  uucp
  12986.       user.   Some of them contain passwords and telephone numbers, and there-
  12987.       fore should have permissions of 600.(2)
  12988.  
  12989.  
  12990.            The central UUCP configuration file is /usr/lib/uucp/config, and is
  12991.       used to set general parameters. The most important of them (and for now,
  12992.       the  only  one),  is your host's UUCP name. At the Virtual Brewery, they
  12993.       use vstout as their UUCP gateway:
  12994.  
  12995.  
  12996.  
  12997.            # /usr/lib/uucp/config - UUCP main configuration file
  12998.            hostname         vstout
  12999.  
  13000.  
  13001.  
  13002.  
  13003.            The  next important configuration file is the sys file. It contains
  13004.       all system-specific information  of  sites  you  are  linked  to.   This
  13005.       includes  the  site's  name, and information on the link itself, such as
  13006.       the telephone number when using a modem link.  A  typical  entry  for  a
  13007.       modem-connected site called pablo would be
  13008.  
  13009.  
  13010.  
  13011.            # /usr/lib/uucp/sys - name UUCP neighbors
  13012.            # system: pablo
  13013.            system          pablo
  13014.            time            Any
  13015.            phone           123-456
  13016.            port            serial1
  13017.            speed           38400
  13018.            chat            ogin: vstout ssword: lorca
  13019.  
  13020.  
  13021.  
  13022.  
  13023.            The  port  names a port to be used, and time specifies the times at
  13024.       which it may be called.  chat describes the login chat  scripts  --  the
  13025.       sequence  of  strings  that must be exchanged between to allow uucico to
  13026.       log into pablo.  We will get back to chat scripts later.  The port  com-
  13027.       mand  does  not name a device special file such as /dev/cua1, but rather
  13028.       names an entry in the port file.  You can assign these names as you like
  13029.       as long as they refer to a valid entry in port.
  13030.  
  13031.  
  13032.       
  13033.  
  13034.       2. Note that although most UUCP commands must be  setuid  to
  13035.          uucp,  you  must  make  sure  the  uuchk  program is not.
  13036.          Otherwise, users will be able to display  passwords  even
  13037.          though they have mode 600.
  13038.  
  13039.  
  13040.  
  13041.  
  13042.  
  13043.  
  13044.  
  13045.                                  - 198 -
  13046.  
  13047.  
  13048.  
  13049.            The  port  file holds information specific to the link itself.  For
  13050.       modem links, it describes the device special file to be used, the  range
  13051.       of  speeds supported, and the type of dialing equipment connected to the
  13052.       port. The entry below describes /dev/cua1 (a.k.a. COM  2),  to  which  a
  13053.       NakWell  modem  is  connected that is capable of running at speeds up to
  13054.       38400bps.  The entry's name way chosen to match the port name  given  in
  13055.       the sys file.
  13056.  
  13057.  
  13058.  
  13059.            # /usr/lib/uucp/port - UUCP ports
  13060.            # /dev/cua1 (COM2)
  13061.            port            serial1
  13062.            type            modem
  13063.            device          /dev/cua1
  13064.            speed           38400
  13065.            dialer          nakwell
  13066.  
  13067.  
  13068.  
  13069.  
  13070.            The information pertaining to the dialers itself  is  kept  in  yet
  13071.       another  file,  called -- you guessed it: dial. For each dialer type, it
  13072.       basically contains the sequence of commands to be issued to  dial  up  a
  13073.       remote  site,  given the telephone number. Again, this is specified as a
  13074.       chat script. For example, the entry for the  above  NakWell  might  look
  13075.       like this:
  13076.  
  13077.  
  13078.  
  13079.            # /usr/lib/uucp/dial - per-dialer information
  13080.            # NakWell modems
  13081.            dialer          nakwell
  13082.            chat            "" ATZ OK ATDT\T CONNECT
  13083.  
  13084.  
  13085.  
  13086.  
  13087.            The  line starting with chat specifies the modem chat, which is the
  13088.       sequence of commands sent to and received from the modem  to  initialize
  13089.       it  and  make  it  dial  the desired number. The ``\T'' sequence will be
  13090.       replaced with the phone number by uucico.
  13091.  
  13092.  
  13093.  
  13094.  
  13095.  
  13096.            To give you a rough idea how uucico deals with these  configuration
  13097.       files, assume you issued the command
  13098.  
  13099.  
  13100.            $ uucico -s pablo
  13101.  
  13102.  
  13103.  
  13104.  
  13105.  
  13106.  
  13107.  
  13108.  
  13109.  
  13110.  
  13111.                                  - 199 -
  13112.  
  13113.  
  13114.  
  13115.  
  13116.  
  13117.  
  13118.  
  13119.       Figure 18.   Interaction of Taylor UUCP Configuration Files.
  13120.  
  13121.       on the command line. The first thing uucico does is look up pablo in the
  13122.       sys file. From the sys file entry for pablo it sees that it  should  use
  13123.       the  serial1  port  to establish the connection.  The port file tells it
  13124.       that this is a modem port, and that it has a NakWell modem attached.
  13125.  
  13126.  
  13127.            uucico now searches dial  for  the  entry  describing  the  NakWell
  13128.       modem,  and  having  found one, opens the serial port /dev/cua1 and exe-
  13129.       cutes the dialer chat. That is, it sends ``ATZ'', waits for  the  ``OK''
  13130.       response,  etc.  When encountering the string ``\T'', it substitutes the
  13131.       phone number (123--456) extracted from the sys file.
  13132.  
  13133.  
  13134.            After the modem returns CONNECT, the  connection  has  been  estab-
  13135.       lished,  and  the  modem chat is complete. uucico now returns to the sys
  13136.       file and executes the login chat. In our example, it would wait for  the
  13137.       ``login:''  prompt,  then  send  its  user  name  (neruda), wait for the
  13138.       ``password:'' prompt, and send its password, ``lorca''.
  13139.  
  13140.  
  13141.            After completing authorization, the remote end is assumed  to  fire
  13142.       up its own uucico. The two will then enter the handshake phase described
  13143.       in the previous section.
  13144.  
  13145.  
  13146.            The way the configuration files depend on each other is also  shown
  13147.       in figure 13.3.1.
  13148.  
  13149.  
  13150.  
  13151.  
  13152.  
  13153.       13.3.2  What UUCP Needs to Know
  13154.  
  13155.       Before  you  start  writing  the  UUCP  configuration files, you have to
  13156.       gather some information it needs to know.
  13157.  
  13158.  
  13159.            First, you will have to figure out what serial device your modem is
  13160.       attached  to.   Usually,  the  (DOS)  ports COM1 through COM4 map to the
  13161.       device special files /dev/cua0 through /dev/cua3.   Most  distributions,
  13162.       such as Slackware, create a link /dev/modem as a link to the appropriate
  13163.       cua* device file, and configure kermit, seyon, etc, to use this  generic
  13164.       file.   In this case, you should either use /dev/modem in your UUCP con-
  13165.       figuration, too.
  13166.  
  13167.  
  13168.            The reason for this is that all  dial-out  programs  use  so-called
  13169.  
  13170.  
  13171.  
  13172.  
  13173.  
  13174.  
  13175.  
  13176.  
  13177.                                  - 200 -
  13178.  
  13179.  
  13180.  
  13181.       lock  files  to  signal when a serial port is in use. The names of these
  13182.       lock files are a concatenation of the string LCK.. and the  device  file
  13183.       name,  for  instance  LCK..cua1. If programs use different names for the
  13184.       same device, they will fail to recognize each other's lock files.  As  a
  13185.       consequence,  they will disrupt each other's session when started at the
  13186.       same time.  This is not an unlikely event when you  schedule  your  UUCP
  13187.       calls using a crontab entry.
  13188.  
  13189.  
  13190.            For  details of setting up your serial ports, please refer to chap-
  13191.       ter 5..
  13192.  
  13193.  
  13194.            Next, you must find out at what speed your  modem  and  Linux  will
  13195.       communicate.   You will have to set this to the maximum effective trans-
  13196.       fer rate you expect to get. The effective  transfer  rate  may  be  much
  13197.       higher  than  the  raw  physical transfer rate your modem is capable of.
  13198.       For instance, many modems send and receive data  at  2400bps  (bits  per
  13199.       second).  Using compression protocols such as V.42bis, the actual trans-
  13200.       fer rate may climb up to 9600bps.
  13201.  
  13202.  
  13203.            Of course, if UUCP is to do anything, you will need the phone  num-
  13204.       ber  of a system to call.  Also, you will need a valid login id and pos-
  13205.       sibly a password for the remote machine.(3)
  13206.  
  13207.  
  13208.             You will also have to know exactly how to  log  into  the  system.
  13209.       E.g.,  do  you  have  to  press  the  BREAK  key before the login prompt
  13210.       appears? Does it display login: or user:? This is necessary for  compos-
  13211.       ing  the chat script, which is a recipe telling uucico how to log in. If
  13212.       you don't know, or if the usual chat script fails, try to call the  sys-
  13213.       tem  with  a  terminal  program  like  kermit or minicom, and write down
  13214.       exactly what you have to do.
  13215.  
  13216.  
  13217.       13.3.3  Site Naming
  13218.  
  13219.  
  13220.  
  13221.  
  13222.            As with TCP/IP-based networking, your host has to have a  name  for
  13223.       UUCP  networking. As long as you simply want to use UUCP for file trans-
  13224.       fers to or from sites you dial up directly, or on a local network,  this
  13225.       name does not have to meet any standards.(4)
  13226.  
  13227.       
  13228.  
  13229.       3. If you're just going to try out UUCP, get the  number  of
  13230.          an  archive  site  near  you.  Write  down  the login and
  13231.          password -- they're public to  make  anonymous  downloads
  13232.          possible. In most cases, they're something like uucp/uucp
  13233.          or nuucp/uucp.
  13234.       4. The only limitation is that it shouldn't be longer than 7
  13235.          characters, so as to not confuse hosts  with  filesystems
  13236.          that impose a narrow limit on file names.
  13237.  
  13238.  
  13239.  
  13240.  
  13241.  
  13242.  
  13243.  
  13244.                                  - 201 -
  13245.  
  13246.  
  13247.  
  13248.            However,  if you use UUCP for a mail or news link, you should think
  13249.       about having the name registered with the UUCP Mapping project. The UUCP
  13250.       Mapping  Project is described in chapter 14.. Even if you participate in
  13251.       a domain, you might consider having an official UUCP name for your site.
  13252.  
  13253.  
  13254.            Frequently, people choose their UUCP name to match the first compo-
  13255.       nent of their fully qualified domain name. Suppose  your  site's  domain
  13256.       address  is  swim.twobirds.com,  then your UUCP host name would be swim.
  13257.       Think of UUCP sites as knowing each other on  a  first-name  basis.   Of
  13258.       course,  you can also use a UUCP name completely unrelated to your fully
  13259.       qualified domain name.
  13260.  
  13261.  
  13262.             However, make sure not to use the unqualified site  name  in  mail
  13263.       addresses  unless  you have registered it as your official UUCP name.(5)
  13264.       At the very best, mail to an unregistered UUCP host will vanish in  some
  13265.       big black bit bucket. If you use a name already held by some other site,
  13266.       this mail will be routed to that site, and cause its postmaster  no  end
  13267.       of headaches.
  13268.  
  13269.  
  13270.            By  default,  the  UUCP  suite uses the name set by hostname as the
  13271.       site's UUCP name. This name is commonly set in the /etc/rc.local script.
  13272.       If  your UUCP name is different from what you set your host name to, you
  13273.       have to use the hostname option in the config file to tell uucico  about
  13274.       your UUCP name. This is described below.
  13275.  
  13276.  
  13277.       13.3.4  Taylor Configuration Files
  13278.  
  13279.       We now return to the configuration files.  Taylor UUCP gets its informa-
  13280.       tion from the following files:
  13281.  
  13282.  
  13283.  
  13284.  
  13285.          config This is the main  configuration  file.  You  can  define  your
  13286.                 site's UUCP name here.
  13287.  
  13288.  
  13289.             sys This file describes all sites known to you.  For each site, it
  13290.                 specifies its name, at what times to call it, which number  to
  13291.                 dial  (if any), what type of device to use, and how to log on.
  13292.  
  13293.  
  13294.            port Contains entries describing each port available, together with
  13295.                 the line speed supported and the dialer to be used.
  13296.  
  13297.  
  13298.       
  13299.  
  13300.       5. The  UUCP  Mapping  Project  registers all UUCP hostnames
  13301.          world-wide and makes sure they are  unique.  To  register
  13302.          your  UUCP  name,  ask  the  maintainers of the site that
  13303.          handles your mail; they will be able to help you with it.
  13304.  
  13305.  
  13306.  
  13307.  
  13308.  
  13309.  
  13310.  
  13311.                                  - 202 -
  13312.  
  13313.  
  13314.  
  13315.            dial Describes dialers used to establish a telephone connection.
  13316.  
  13317.  
  13318.        dialcode Contains expansions for symbolic dialcodes.
  13319.  
  13320.  
  13321.            call Contains the login name and password to be used when calling a
  13322.                 system.  Rarely used.
  13323.  
  13324.  
  13325.          passwd Contains login names and passwords systems may use  when  log-
  13326.                 ging in. This file is used only when uucico does its own pass-
  13327.                 word checking.
  13328.  
  13329.  
  13330.  
  13331.  
  13332.  
  13333.            Taylor configuration files are generally made up of lines  contain-
  13334.       ing  keyword-value  pairs. A hash sign introduces a comment that entends
  13335.       to the end of the line. To use a hash sign by itself, you may escape  it
  13336.       with a backslash.
  13337.  
  13338.  
  13339.            There are quite a number of options you can tune with these config-
  13340.       uration files.  We can't go into all  parameters  here,  but  will  only
  13341.       cover  the  most  important ones. They you should be able to configure a
  13342.       modem-based UUCP link.  Additional sections will describe the  modifica-
  13343.       tions  necessary  if  you  want to use UUCP over TCP/IP or over a direct
  13344.       serial line.  A complete reference is given  in  the  Texinfo  documents
  13345.       that accompany the Taylor UUCP sources.
  13346.  
  13347.  
  13348.              When  you  think you have configured your UUCP system completely,
  13349.       you can check your  configuration  using  the  uuchk  tool  (located  in
  13350.       /usr/lib/uucp).  uuchk  reads your configuration files, and prints out a
  13351.       detailed report of the configuration values used for each system.
  13352.  
  13353.  
  13354.       13.3.5  General Configuration Options -- the config File
  13355.  
  13356.  
  13357.  
  13358.  
  13359.            You won't generally use this file to describe much beside your UUCP
  13360.       hostname.   By default, UUCP will use the name you set with the hostname
  13361.       command, but it is generally a good idea to set the  UUCP  name  explic-
  13362.       itly. A sample file is shown below:
  13363.  
  13364.  
  13365.  
  13366.  
  13367.  
  13368.  
  13369.  
  13370.  
  13371.  
  13372.  
  13373.  
  13374.  
  13375.  
  13376.  
  13377.                                  - 203 -
  13378.  
  13379.  
  13380.  
  13381.            # /usr/lib/uucp/config - UUCP main configuration file
  13382.            hostname        vstout
  13383.  
  13384.  
  13385.  
  13386.  
  13387.            Of course, there are a number of miscellaneous parameters that  may
  13388.       be  set  here,  too,  such as the name of the spool directory, or access
  13389.       rights for anonymous UUCP.  The latter will be described in a later sec-
  13390.       tion.
  13391.  
  13392.  
  13393.       13.3.6  How to Tell UUCP about other Systems -- the sys File
  13394.  
  13395.  
  13396.  
  13397.  
  13398.            The  sys  file  describes the systems your machine knows about.  An
  13399.       entry is introduced by the system keyword; the subsequent  lines  up  to
  13400.       the  next  system directive detail the parameters specific to that site.
  13401.       Commonly, a system entry will define parameters such  as  the  telephone
  13402.       number and the login chat.
  13403.  
  13404.  
  13405.            Parameters  before  the  very  first system line set default values
  13406.       used for all systems.  Usually, you will set protocol paramters and  the
  13407.       like in the defaults section.
  13408.  
  13409.  
  13410.            Below, the most prominent fields are discussed in some detail.
  13411.  
  13412.  
  13413.       13.3.6.1  System Name
  13414.  
  13415.  
  13416.  
  13417.            The  system  command  names the remote system. You must specify the
  13418.       correct name of the remote system, not an alias  you  invented,  because
  13419.       uucico  will  check  it against what the remote system says it is called
  13420.       when you log on.(6)
  13421.  
  13422.  
  13423.            Each system name may appear more only once.  If  you  want  to  use
  13424.       several  sets  of  configurations for the same system (such as different
  13425.       telephone numbers uucico should try in turn),  you  can  specify  alter-
  13426.       nates.  Alternates are described below.
  13427.  
  13428.  
  13429.  
  13430.  
  13431.  
  13432.       
  13433.  
  13434.       6. Older Version 2 UUCP's don't broadcast  their  name  when
  13435.          being  called;  however,  newer implementations often do,
  13436.          and so does Taylor UUCP.
  13437.  
  13438.  
  13439.  
  13440.  
  13441.  
  13442.  
  13443.  
  13444.                                  - 204 -
  13445.  
  13446.  
  13447.  
  13448.       13.3.6.2  Telephone Number
  13449.  
  13450.  
  13451.  
  13452.            If  the  remote  system is to be reached over a telephone line, the
  13453.       phone field specifies the number the modem should dial.  It may  contain
  13454.       several tokens interpreted by uucico's dialing procedure.  An equal sign
  13455.       means to wait for a secondary dial tone, and a  dash  generates  a  one-
  13456.       second pause. For instance, some telephone installations will choke when
  13457.       you don't pause between dialing the prefix code and telephone number.
  13458.  
  13459.  
  13460.            [Don't know the proper English term for this -- you know, something
  13461.       like  a company's private internal installation where you have to dial a
  13462.       0 or 9 to get a line to the outside.]
  13463.  
  13464.  
  13465.             Any embedded alphabetic string may be used to hide  site-dependent
  13466.       information like area codes. Any such string is translated to a dialcode
  13467.       using the dialcode file. Suppose you have the following dialcode file:
  13468.  
  13469.  
  13470.  
  13471.            # /usr/lib/uucp/dialcode - dialcode translation
  13472.            Bogoham         024881
  13473.            Coxton          035119
  13474.  
  13475.  
  13476.  
  13477.  
  13478.            With  these  translations, you can use a phone number such as Bogo-
  13479.       ham7732 in the sys file, which makes things probably a little more legi-
  13480.       ble.
  13481.  
  13482.  
  13483.       13.3.6.3  Port and Speed
  13484.  
  13485.  
  13486.  
  13487.            The  port  and speed options are used to select the device used for
  13488.       calling the remote system, and the maximum speed  to  which  the  device
  13489.       should be set.(7) A system entry may use either option  alone,  or  both
  13490.       options  in  conjunction.  When looking up a suitable device in the port
  13491.       file, only those ports are selected  that  have  a  matching  port  name
  13492.       and/or speed range.
  13493.  
  13494.  
  13495.            Generally,  using the speed option should suffice. If you have only
  13496.       one serial device defined in port, uucico will  always  pick  the  right
  13497.       one, anyway, so you only have to give it the desired speed.  If you have
  13498.       several modems attached to your systems, you still often don't  want  to
  13499.  
  13500.       
  13501.  
  13502.       7. The  Baud rate of the tty must be at least as high as the
  13503.          maximum transfer speed.
  13504.  
  13505.  
  13506.  
  13507.  
  13508.  
  13509.  
  13510.  
  13511.                                  - 205 -
  13512.  
  13513.  
  13514.  
  13515.       name  a  particular port, because if uucico finds that there are several
  13516.       matches, it tries each device in turn until it finds an unused one.
  13517.  
  13518.  
  13519.       13.3.6.4  The Login Chat
  13520.  
  13521.  
  13522.  
  13523.            Above, we already encountered the login chat  script,  which  tells
  13524.       uucico  how  to  log  into  the remote system.  It consists of a list of
  13525.       tokens, specifying strings expected and sent by the  local  uucico  pro-
  13526.       cess.  The  intention  is  to  make uucico wait until the remote machine
  13527.       sends a login prompt, then return the login name, wait  for  the  remote
  13528.       system  to  send  the password prompt, and send the password. Expect and
  13529.       send strings are given in alternation.  uucico automatically  appends  a
  13530.       carriage  return  character (\r) to any send string. Thus, a simple chat
  13531.       script would look like
  13532.  
  13533.  
  13534.            ogin: vstout ssword: catch22
  13535.  
  13536.  
  13537.  
  13538.  
  13539.            You will notice that the expect  fields  don't  contain  the  whole
  13540.       prompts.   This  is  to  make  sure  that the login succeeds even if the
  13541.       remote system broadcasts Login: instead of login:.
  13542.  
  13543.  
  13544.            uucico also allows for some  sort  of  conditional  execution,  for
  13545.       example  in  the  case that the remote machine's getty needs to be reset
  13546.       before sending a prompt. For this, you  can  attach  a  sub-chat  to  an
  13547.       expect  string,  offset by a dash.  The sub-chat is executed only if the
  13548.       main expect fails, i.e. a timeout occurs.  One way to use  this  feature
  13549.       is  to  send  a BREAK if the remote site doesn't display a login prompt.
  13550.       The following example gives an allround chat  script  that  should  also
  13551.       work  in case you have to hit return before the login appears.  "" tells
  13552.       UUCP to not wait for anything and continue with  the  next  send  string
  13553.       immediately.
  13554.  
  13555.  
  13556.  
  13557.             "" \n\r\d\r\n\c ogin:-BREAK-ogin: vstout ssword: catch22
  13558.  
  13559.  
  13560.  
  13561.  
  13562.            There are a couple of special strings and escape  characters  which
  13563.       may  occur  in  the  chat script. The following is an incomplete list of
  13564.       characters legal in expect strings:
  13565.  
  13566.  
  13567.  
  13568.  
  13569.  
  13570.  
  13571.  
  13572.  
  13573.  
  13574.  
  13575.  
  13576.  
  13577.                                  - 206 -
  13578.  
  13579.  
  13580.  
  13581.               " The empty string. It tells uucico not to  wait  for  anything,
  13582.                 but proceed with the next send string immediately.
  13583.  
  13584.  
  13585.              \t Tab character.
  13586.  
  13587.  
  13588.              \r Carriage return character.
  13589.  
  13590.  
  13591.              \s Space  character.  You  need  this  to  embed spaces in a chat
  13592.                 string.
  13593.  
  13594.  
  13595.              \n Newline character.
  13596.  
  13597.  
  13598.              \\ Backslash character.
  13599.  
  13600.  
  13601.  
  13602.  
  13603.  
  13604.       On send strings, the following escape characters and strings  are  legal
  13605.       in addition to the above:
  13606.  
  13607.  
  13608.  
  13609.  
  13610.             EOT End of transmission character (^D).
  13611.  
  13612.  
  13613.           BREAK Break character.
  13614.  
  13615.  
  13616.              \c Suppress sending of carriage return at end of string.
  13617.  
  13618.  
  13619.              \d Delay sending for 1 second.
  13620.  
  13621.  
  13622.              \E Enable  echo  checking.  This  requires uucico to wait for the
  13623.                 echo of everything it writes to be read back from  the  device
  13624.                 before  it  can continue with the chat. It is primarily useful
  13625.                 when used in modem chats (which we will encounter below). Echo
  13626.                 checking is off by default.
  13627.  
  13628.  
  13629.              \e Disable echo checking.
  13630.  
  13631.  
  13632.              \K Same as BREAK.
  13633.  
  13634.  
  13635.  
  13636.  
  13637.  
  13638.  
  13639.  
  13640.  
  13641.  
  13642.  
  13643.                                  - 207 -
  13644.  
  13645.  
  13646.  
  13647.              \p Pause for fraction of a second.
  13648.  
  13649.  
  13650.  
  13651.  
  13652.  
  13653.  
  13654.       13.3.6.5  Alternates
  13655.  
  13656.  
  13657.  
  13658.            Sometimes  it  is  desirable  to have multiple entries for a single
  13659.       system, for instance if the system can be  reached  on  different  modem
  13660.       lines.  With Taylor UUCP, you can do this by defining a so-called alter-
  13661.       nate.
  13662.  
  13663.  
  13664.            An alternate entry retains all settings from the main system entry,
  13665.       and  and  specifies  only  those values that should be overridden in the
  13666.       default system entry, or added to it.  An alternate is offset  from  the
  13667.       system entry by a line containing the keyword alternate.
  13668.  
  13669.  
  13670.            To  use two phone numbers for pablo, you would modify its sys entry
  13671.       in the following way:
  13672.  
  13673.  
  13674.  
  13675.            system       pablo
  13676.            phone        123-456
  13677.            alternate
  13678.            phone        123-455
  13679.  
  13680.  
  13681.  
  13682.  
  13683.            When calling pablo, uucico will now first dial 123-456, and if this
  13684.       fails, try the alternate.  The alternate entry retains all settings from
  13685.       the main system entry, and overrides only the telephone number.
  13686.  
  13687.  
  13688.       13.3.6.6  Restricting Call Times
  13689.  
  13690.  
  13691.  
  13692.            Taylor  UUCP  provides  a number of ways you may restrict the times
  13693.       when calls can be placed to a remote system.  You might do  this  either
  13694.       because  of  limitations  the  remote host places on its services during
  13695.       business hours, or simply to avoid times with high call rates. Note that
  13696.       it  is  always  possible  to  override  call time restrictions by giving
  13697.       uucico the -S or -f option.
  13698.  
  13699.  
  13700.            By default, Taylor UUCP will disallow connections at any  time,  so
  13701.  
  13702.  
  13703.  
  13704.  
  13705.  
  13706.  
  13707.  
  13708.  
  13709.                                  - 208 -
  13710.  
  13711.  
  13712.  
  13713.       you have to use some sort of time specification in the sys file.  If you
  13714.       don't care about call time restrictions, you can specify the time option
  13715.       with a value of Any in your sys file.
  13716.  
  13717.  
  13718.            The  simplest way to restrict call time is the time entry, which is
  13719.       followed by a string made up of a day and a time subfield.  Day  may  be
  13720.       any  of  Mo,  Tu,  We, Th, Fr, Sa, Su combined, or Any, Never, or Wk for
  13721.       weekdays. The time consists of two 24-hour clock values, separated by  a
  13722.       dash.  They specify the range during which calls may be placed. The com-
  13723.       bination of these tokens is written without white space in between.  Any
  13724.       number  of day and time specifications may be grouped together with com-
  13725.       mas.  For example,
  13726.  
  13727.  
  13728.  
  13729.            time            MoWe0300-0730,Fr1805-2000
  13730.  
  13731.  
  13732.  
  13733.  
  13734.       allows calls on Monday and Wednesdays from 3 a.m. to 7.30, and  on  Fri-
  13735.       days  between  18.05  and  20.00.  When a time field spans midnight, say
  13736.       Mo1830-0600, it actually means Monday, between midnight and 6 a.m.,  and
  13737.       between 6.30 p.m. and midnight.
  13738.  
  13739.  
  13740.            The  special  time  strings Any and Never mean what they say: Calls
  13741.       may be placed at any or no time, respectively.
  13742.  
  13743.  
  13744.             The time command takes an optional second argument that  describes
  13745.       a  retry  time  in  minutes.  When  an attempt to establish a connection
  13746.       fails, uucico will not allow another attempt to dial up the remote  host
  13747.       within  a certain interval. By default, uucico uses an exponential back-
  13748.       off scheme, where the retry interval increases with each repeated  fail-
  13749.       ure.   For  instance, when you specify a retry time of 5 minutes, uucico
  13750.       will refuse to call the remote system within 5 minutes  after  the  last
  13751.       failure.
  13752.  
  13753.  
  13754.              The  timegrade command allows you to attach a maximum spool grade
  13755.       to a schedule. For instance, assume you  have  the  following  timegrade
  13756.       commands in a system entry:
  13757.  
  13758.  
  13759.  
  13760.            timegrade           N Wk1900-0700,SaSu
  13761.            timegrade           C Any
  13762.  
  13763.  
  13764.  
  13765.  
  13766.            This allows jobs with a spoolgrade of C or higher (usually, mail is
  13767.  
  13768.  
  13769.  
  13770.  
  13771.  
  13772.  
  13773.  
  13774.  
  13775.                                  - 209 -
  13776.  
  13777.  
  13778.  
  13779.       queued  with  grade  B or C) to be transferred whenever a call is estab-
  13780.       lished, while news (usually queued with grade  N)  will  be  transferred
  13781.       only during the night and at weekends.
  13782.  
  13783.  
  13784.            Just  like  time,  the  timegrade command takes a retry interval in
  13785.       minutes as an optional third argument.
  13786.  
  13787.  
  13788.            However, a caveat about spool grades is in order here:  First,  the
  13789.       timegrade  option  applies  only  to what your systems sends; the remote
  13790.       system may still transfer anything it likes.   You  can  use  the  call-
  13791.       timegrade  option  to explicitly request it to send only jobs above some
  13792.       given  spool  grade;  but  there's  no  guarantee  it  will  obey   this
  13793.       request.(8)
  13794.  
  13795.  
  13796.            Similarly,  the timegrade field is not checked when a remote system
  13797.       calls in, so any jobs queued for the calling system will be sent.   How-
  13798.       ever,  the  remote system can explicitly request your uucico to restrict
  13799.       itself to a certain spool grade.
  13800.  
  13801.  
  13802.  
  13803.  
  13804.  
  13805.       13.3.7  What Devices there are -- the port File
  13806.  
  13807.  
  13808.  
  13809.  
  13810.            The port file tells uucico about the available ports.  These may be
  13811.       modem ports, but other types such as direct serial lines and TCP sockets
  13812.       are supported as well.
  13813.  
  13814.  
  13815.            Like the sys file, port consists of separate entries starting  with
  13816.       the  keyword  port, followed by the port name.  This name may be used by
  13817.       in the sys file's port statement.  The name need not be unique; if there
  13818.       are several ports with the same name, uucico will try each in turn until
  13819.       it finds one that is not currently being used.
  13820.  
  13821.  
  13822.            The port command should be immediately followed by the type  state-
  13823.       ment  that  describes  what  type of port is described.  Valid types are
  13824.       modem, direct for direct connections, and tcp for TCP  sockets.  If  the
  13825.       port command is missing, the port type defaults to modem.
  13826.  
  13827.  
  13828.            In  this  section,  we  will  cover only modem ports; TCP ports and
  13829.       direct lines are discussed in a later section.
  13830.  
  13831.  
  13832.       
  13833.  
  13834.       8. If the remote system runs Talyor UUCP, it will obey.
  13835.  
  13836.  
  13837.  
  13838.  
  13839.  
  13840.  
  13841.  
  13842.                                  - 210 -
  13843.  
  13844.  
  13845.  
  13846.            For modem and direct ports, you have  to  specify  the  device  for
  13847.       calling  out using the device directive.  Usually, this is the name of a
  13848.       device special file in the /dev directory, like /dev/cua1.(9)
  13849.  
  13850.  
  13851.            In  the case of a modem device, the port entry also determines what
  13852.       type of modem is connected to the port.  Different types of modems  have
  13853.       to  be  configured  differently.   Even  modems  that claim to be Hayes-
  13854.       compatible needn't be really compatible with each other.  Therefore, you
  13855.       have  to tell uucico how to initialize the modem and how to make it dial
  13856.       the desired number.  Taylor UUCP keeps the descriptions of  all  dialers
  13857.       in  a  file  named  dial.   To use any of these, you have to specify the
  13858.       dialer's name using the dialer command.
  13859.  
  13860.  
  13861.            Sometimes, you will want to use a modem in different ways,  depend-
  13862.       ing  on  which  system  you call.  For instance, some older modems don't
  13863.       understand when a high-speed modem attempts to connect at 14400bps; they
  13864.       simply  drop the line instead of negotiating a connect at, say, 9600bps.
  13865.       When you know site drop uses such a dumb modem, you have to set up  your
  13866.       modem  differently  when  calling them. For this, you need an additional
  13867.       port entry in the port file that specifies a different dialer.  Now  you
  13868.       can  give  the  new port a different name, such as serial1-slow, and use
  13869.       the port directive in drop system entry in sys.
  13870.  
  13871.  
  13872.            A better way is to distinguish the ports by the  speeds  they  sup-
  13873.       port.   For  instance,  the two port entries for the above situation may
  13874.       look like this:
  13875.  
  13876.  
  13877.  
  13878.            # NakWell modem; connect at high speed
  13879.            port            serial1         # port name
  13880.            type            modem           # modem port
  13881.            device          /dev/cua1       # this is COM2
  13882.            speed           38400           # supported speed
  13883.            dialer          nakwell         # normal dialer
  13884.  
  13885.            # NakWell modem; connect at low speed
  13886.            port            serial1         # port name
  13887.            type            modem           # modem port
  13888.            device          /dev/cua1       # this is COM2
  13889.            speed           9600            # supported speed
  13890.            dialer          nakwell-slow    # don't attempt fast connect
  13891.  
  13892.  
  13893.  
  13894.  
  13895.            The system entry for site drop would now give serial1 as port name,
  13896.       but  request  to use it at 9600bps only.  uucico will then automatically
  13897.  
  13898.       
  13899.  
  13900.       9. Some people use the  ttyS*  devices  instead,  which  are
  13901.          intended for dial-in only.
  13902.  
  13903.  
  13904.  
  13905.  
  13906.  
  13907.  
  13908.  
  13909.                                  - 211 -
  13910.  
  13911.  
  13912.  
  13913.       use the second port entry. All remaining sites  that  have  a  speed  of
  13914.       38400bps  in the system entry will be called using the first port entry.
  13915.  
  13916.  
  13917.  
  13918.  
  13919.  
  13920.       13.3.8  How to Dial a Number -- the dial File
  13921.  
  13922.  
  13923.  
  13924.  
  13925.            The dial file describes the way various dialers are  used.   Tradi-
  13926.       tionally,  UUCP  talks of dialers rather than modems, because in earlier
  13927.       times, it was usual practice to have one (expensive)  automatic  dialing
  13928.       device  serve  a  whole  bank of modems. Today, most modems have dialing
  13929.       support builtin, so this distinction gets a little blurred.
  13930.  
  13931.  
  13932.            Nevertheless, different dialers or modems may require  a  different
  13933.       configuration.  You can describe each of them in the dial file.  Entries
  13934.       in dial start with the dialer command that gives the dialer's name.
  13935.  
  13936.  
  13937.            The most important entry beside this is the modem  chat,  specified
  13938.       by  the  chat  command.  Similar  to  the  login  chat, it consists of a
  13939.       sequence of strings uucico sends to the  dialer  and  the  responses  it
  13940.       expects  in return. It is commonly used to reset the modem to some known
  13941.       state, and dial the number. The following sample dialer  entry  shows  a
  13942.       typical modem chat for a Hayes-compatible modem:
  13943.  
  13944.  
  13945.  
  13946.            # NakWell modem; connect at high speed
  13947.            dialer          nakwell         # dialer name
  13948.            chat            "" ATZ OK\r ATH1E0Q0 OK\r ATDT\T CONNECT
  13949.            chat-fail       BUSY
  13950.            chat-fail       ERROR
  13951.            chat-fail       NO\sCARRIER
  13952.            dtr-toggle      true
  13953.  
  13954.  
  13955.  
  13956.  
  13957.            The  modem  chat  begins  with "", the empty expect string.  uucico
  13958.       will therefore send the first command (ATZ)  right  away.   ATZ  is  the
  13959.       Hayes command to reset the modem. It then waits until the modem has sent
  13960.       OK, and sends the next command which turns off local echo, and the like.
  13961.       After  the  modem  returns  OK  again,  uucico sends the dialing command
  13962.       (ATDT). The escape sequence \T in this string is replaced with the phone
  13963.       number  taken  from the system entry sys file. uucico then waits for the
  13964.       modem to return the string CONNECT, which signals that a connection with
  13965.       the remote modem has been established successfully.
  13966.  
  13967.  
  13968.  
  13969.  
  13970.  
  13971.  
  13972.  
  13973.  
  13974.  
  13975.                                  - 212 -
  13976.  
  13977.  
  13978.  
  13979.            Often,  the  modem  fails  to  connect  to  the  remote system, for
  13980.       instance if the other system is talking to someone else and the line  is
  13981.       busy.  In this case, the modem will return some error message indicating
  13982.       the reason.  Modem chats are not capable to detect such messages; uucico
  13983.       will  continue  to  wait for the expected string until it times out. The
  13984.       UUCP log file will therefore only show  a  bland  ``timed  out  in  chat
  13985.       script'' instead of the true reason.
  13986.  
  13987.  
  13988.            However,  Taylor  UUCP  allows you to tell uucico about these error
  13989.       messages using the chat-fail command as shown above. When uucico detects
  13990.       a  chat-fail  string while executing the modem chat, it aborts the call,
  13991.       and logs the error message in the UUCP log file.
  13992.  
  13993.  
  13994.            The last command in the example shown above tells  UUCP  to  toggle
  13995.       the  DTR line before starting the modem chat. Most modems can be config-
  13996.       ured to go on-hook when detecting a change on the DTR  line,  and  enter
  13997.       command mode.(10)
  13998.  
  13999.  
  14000.  
  14001.  
  14002.  
  14003.       13.3.9  UUCP Over TCP
  14004.  
  14005.  
  14006.  
  14007.  
  14008.            Absurd as it may sound at the first moment, using UUCP to  transfer
  14009.       data  over  TCP not that bad an idea, especially when transferring large
  14010.       amount of data such as Usenet news.  On TCP-based links, news is  gener-
  14011.       ally exchanged using the NNTP protocol, where articles are requested and
  14012.       sent  individually,  without  compression  or  any  other  optimization.
  14013.       Although  adequate  for  large  sites with several concurrent newsfeeds,
  14014.       this technique is very unfavorable for small sites  that  receive  their
  14015.       news over a slow connection such as ISDN.  These sites will usually want
  14016.       to combine the qualities of TCP with the advantages of sending  news  in
  14017.       large  batches,  which  can be compressed and thus transferred with very
  14018.       low overhead. A standard way to transfer these batches is  to  use  UUCP
  14019.       over TCP.
  14020.  
  14021.  
  14022.            In sys, you would specify a system to be called via TCP in the fol-
  14023.       lowing way:
  14024.  
  14025.  
  14026.  
  14027.  
  14028.       
  14029.  
  14030.       10.You  can  also  configure some modems to reset themselves
  14031.          when detecting  a  transition  on  DTR.   Some  of  them,
  14032.          however,  don't  seem  to like this, and occasionally get
  14033.          hung.
  14034.  
  14035.  
  14036.  
  14037.  
  14038.  
  14039.  
  14040.  
  14041.                                  - 213 -
  14042.  
  14043.  
  14044.  
  14045.            system          gmu
  14046.            address         news.groucho.edu
  14047.            time            Any
  14048.            port            tcp-conn
  14049.            chat            ogin: vstout word: clouseau
  14050.  
  14051.  
  14052.  
  14053.  
  14054.            The  address command gives the IP address of the host, or its fully
  14055.       qualified domain name.  The corresponding port entry would read:
  14056.  
  14057.  
  14058.  
  14059.            port            tcp-conn
  14060.            type            tcp
  14061.            service         540
  14062.  
  14063.  
  14064.  
  14065.  
  14066.            The  entry  states  that a TCP connection should be used when a sys
  14067.       entry references tcp-conn, and that uucico should attempt to connect  to
  14068.       the  TCP  network port 540 on the remote host.  This is the default port
  14069.       number of the UUCP service. Instead of the port  number,  you  may  also
  14070.       give a symbolic port name to the service command. The port number corre-
  14071.       sponding to this name will be looked up  in  /etc/services.  The  common
  14072.       name for the UUCP service is uucpd.
  14073.  
  14074.  
  14075.       13.3.10  Using a Direct Connection
  14076.  
  14077.  
  14078.  
  14079.  
  14080.            Assume you use a direct line connecting your system vstout to tiny.
  14081.       Very much like in the modem case, you have to write a  system  entry  in
  14082.       the sys file. The port command identifies the serial port tiny is hooked
  14083.       up to.
  14084.  
  14085.  
  14086.  
  14087.            system          tiny
  14088.            time            Any
  14089.            port            direct1
  14090.            speed           38400
  14091.            chat            ogin: cathcart word: catch22
  14092.  
  14093.  
  14094.  
  14095.  
  14096.            In the port file, you have to describe  the  serial  port  for  the
  14097.       direct connection. A dialer entry is not needed, because there's no need
  14098.       for dialing.
  14099.  
  14100.  
  14101.  
  14102.  
  14103.  
  14104.  
  14105.  
  14106.  
  14107.                                  - 214 -
  14108.  
  14109.  
  14110.  
  14111.            port            direct1
  14112.            type            direct
  14113.            speed           38400
  14114.  
  14115.  
  14116.  
  14117.  
  14118.       13.4  The Do's and Dont's of UUCP -- Tuning Permissions
  14119.  
  14120.  
  14121.  
  14122.  
  14123.       13.4.1  Command Execution
  14124.  
  14125.  
  14126.  
  14127.  
  14128.            UUCP's  task  is  to  copy files from one system to another, and to
  14129.       request execution of certain commands on remote hosts. Of course, you as
  14130.       an  administrator would want to control what rights you grant other sys-
  14131.       tems -- allowing them to execute any command on  your  system  is  defi-
  14132.       nitely not a good idea.
  14133.  
  14134.  
  14135.              By default, the only commands Taylor UUCP allows other systems to
  14136.       execute on your machine are rmail and rnews, which are commonly used  to
  14137.       to exchange email and Usent news over UUCP. The default search path used
  14138.       by uuxqt is a compile-time option,  but  should  usually  contain  /bin,
  14139.       /usr/bin,  and /usr/local/bin.  To change the set of commands for a par-
  14140.       ticular system, you can use the commands keyword in the sys file.  Simi-
  14141.       larly,  the  search path can be changed with the command-path statement.
  14142.       For instance, you may want to allow system pablo to  execute  the  rsmtp
  14143.       command in addition to rmail and rnews:(11)
  14144.  
  14145.  
  14146.  
  14147.            system          pablo
  14148.            commands        rmail rnews rsmtp
  14149.  
  14150.  
  14151.  
  14152.  
  14153.       13.4.2  File Transfers
  14154.  
  14155.  
  14156.  
  14157.  
  14158.            Taylor  UUCP  also  allows you to fine-tune file transfers in great
  14159.       detail.  At one extreme, you can disable transfers to and from a partic-
  14160.       ular  system.  Just set request to no, and the remote system will not be
  14161.       able either to retrieve files from your system or  send  it  any  files.
  14162.  
  14163.       
  14164.  
  14165.       11.rsmtp  is used to deliver mail with batched SMTP. This is
  14166.          described in the mail chapters.
  14167.  
  14168.  
  14169.  
  14170.  
  14171.  
  14172.  
  14173.  
  14174.                                  - 215 -
  14175.  
  14176.  
  14177.  
  14178.       Similarly,  you  can  prohibit  your users from transferring files to or
  14179.       from a system by setting transfer to no.  By default, users on both  the
  14180.       local and the remote system are allowed to up- and download files.
  14181.  
  14182.  
  14183.            In  addition,  you  can configure the directories to and from which
  14184.       files may be copied. Usually, you will  want  to  restrict  access  from
  14185.       remote  systems  to  a  single directory hierarchy, but still allow your
  14186.       users to send files from their home directory.  Commonly,  remote  users
  14187.       will  be  allowed  to receive files only from the public UUCP directory,
  14188.       /var/spool/uucppublic.  This is the traditional place to make files pub-
  14189.       licly available; very much like FTP servers on the Internet.  It is com-
  14190.       monly referred to using the tilde character.
  14191.  
  14192.  
  14193.            Therefore, Taylor UUCP provides four different commands to  config-
  14194.       ure  the  directories  for  sending and receiving files. They are local-
  14195.       send, which specifies the list of directories a user  may  ask  UUCP  to
  14196.       send  files from; local-receive, which gives the the list of directories
  14197.       a user may ask to receive files to; and remote-send and  remote-receive,
  14198.       which do the analogous for requests from a foreign system.  Consider the
  14199.       following example:
  14200.  
  14201.  
  14202.  
  14203.            system          pablo
  14204.            local-send      /home ~
  14205.            local-receive   /home ~/receive
  14206.            remote-send     ~ !~/incoming !~/receive
  14207.            remote-receive  ~/incoming
  14208.  
  14209.  
  14210.  
  14211.  
  14212.            The local-send command allows users on your host to send any  files
  14213.       below  /home  and  from  the  public UUCP directory to pablo. The local-
  14214.       receive command allows them  to  receive  files  either  to  the  world-
  14215.       writable  receive  directory  in  the  uucppublic, or any world-writable
  14216.       directory below  /home.   The  remote-send  directive  allows  pablo  to
  14217.       request  files  from  /var/spool/uucppublic,  except for files below the
  14218.       incoming and receive directories. This is signaled to uucico by  preced-
  14219.       ing  the  directory names with exclamation marks. Finally, the last line
  14220.       allows pablo to upload any files to incoming.
  14221.  
  14222.  
  14223.            One of the biggest problems with file transfers using UUCP is  that
  14224.       will  only  receive  files to directories that are world-writable.  This
  14225.       may tempt some users to set up traps for  other  users,  etc.   However,
  14226.       there's  no  way escaping this problem except disabling UUCP file trans-
  14227.       fers altogether.
  14228.  
  14229.  
  14230.  
  14231.  
  14232.  
  14233.  
  14234.  
  14235.  
  14236.  
  14237.  
  14238.  
  14239.  
  14240.                                  - 216 -
  14241.  
  14242.  
  14243.  
  14244.       13.4.3  Forwarding
  14245.  
  14246.  
  14247.  
  14248.  
  14249.            UUCP provides a mechanism to have other systems execute file trans-
  14250.       fers  on  your  behalf.   For  instance,  this  allows  you to make seci
  14251.       retrieve a file from uchile for you, and send it to  your  system.   The
  14252.       following command would achieve this:
  14253.  
  14254.  
  14255.  
  14256.            $ uucp -r seci!uchile!~/find-ls.gz ~/uchile.files.gz
  14257.  
  14258.  
  14259.  
  14260.  
  14261.            This technique of passing a job through several systems  is  called
  14262.       forwarding.    In the above example, the reason to use forwarding may be
  14263.       that seci has UUCP access to uchile, but your host doesn't.  However, if
  14264.       you run a UUCP system, you would want to limit the forwarding service to
  14265.       a few hosts you trust not to run up a horrendous phone  bill  by  making
  14266.       you download the latest X11R6 source release for them.
  14267.  
  14268.  
  14269.            By  default, Taylor UUCP disallows forwarding altogether. To enable
  14270.       forwarding for a particular system, you can  use  the  forward  command.
  14271.       This  command  specifies  a  list of sites the system may request you to
  14272.       forward jobs to and from. For instance, the UUCP administrator  of  seci
  14273.       would  have to add the following lines to the sys file to allow pablo to
  14274.       request files from uchile:
  14275.  
  14276.  
  14277.  
  14278.            ####################
  14279.            # pablo
  14280.            system          pablo
  14281.            forward         uchile
  14282.            ####################
  14283.            # uchile
  14284.            system          uchile
  14285.            forward-to      pablo
  14286.  
  14287.  
  14288.  
  14289.  
  14290.            The  forward-to  entry  for  uchile  is necessary so that any files
  14291.       returned by it are actually passed on to pablo.   Otherwise  UUCP  would
  14292.       drop  them. This entry uses a variation of the forward command that per-
  14293.       mits uchile only to send files to pablo through seci; not the other  way
  14294.       round.
  14295.  
  14296.  
  14297.            To  permit  forwarding  to  any system, use the special keyword ANY
  14298.  
  14299.  
  14300.  
  14301.  
  14302.  
  14303.  
  14304.  
  14305.  
  14306.                                  - 217 -
  14307.  
  14308.  
  14309.  
  14310.       (capital letters required).
  14311.  
  14312.  
  14313.       13.5  Setting up your System for Dialing in
  14314.  
  14315.  
  14316.  
  14317.  
  14318.            If you want to set up your site for dialing in, you have to  permit
  14319.       logins  on  your serial port, and customize some system files to provide
  14320.       UUCP accounts. This will be the topic of the current section.
  14321.  
  14322.  
  14323.       13.5.1  Setting up getty
  14324.  
  14325.  
  14326.  
  14327.  
  14328.            If you want to use a serial line as a  dialin  port,  you  have  to
  14329.       enable  a  getty  process on this port.  However, some getty implementa-
  14330.       tions aren't really suitable for this, because you usually want to use a
  14331.       serial  port for dialing in and out.  You therefore have to make sure to
  14332.       use a getty that is able to share the  line  with  other  programs  like
  14333.       uucico,  or  minicom.  One  program  that  does this is uugetty from the
  14334.       getty ps package.  Most Linux distributions have it; check  for  uugetty
  14335.       in  your  /sbin  directory.  Another program I am aware of is Gert Doer-
  14336.       ing's mgetty, which also supports reception of facsimiles.  You can also
  14337.       obtain  the  latest  versions  of  these  from sunsite.unc.edu as either
  14338.       binary or source.
  14339.  
  14340.  
  14341.            Explaining the differences in the way  uugetty  and  mgetty  handle
  14342.       logins is beyond the scope of this little section; for more information,
  14343.       please refer to the Serial HOWTO by Grag Hankins, as well as  the  docu-
  14344.       mentation that comes along with getty ps and mgetty.
  14345.  
  14346.  
  14347.       13.5.2  Providing UUCP Accounts
  14348.  
  14349.  
  14350.  
  14351.  
  14352.            Next,  you  have  to set up user accounts that let remote sites log
  14353.       into your system and establish a UUCP connection.  Generally,  you  will
  14354.       provide  a separate login name to each system that polls you.  When set-
  14355.       ting up an account for system pablo, you would probably give  it  Upablo
  14356.       as the user name.
  14357.  
  14358.  
  14359.            For  systems that dial in through the serial port, you usually have
  14360.       to add these accounts to the system password file, /etc/passwd.  A  good
  14361.       practice  is  to put all UUCP logins in a special group such as uuguest.
  14362.       The account's home directory should be set to the public spool directory
  14363.       /var/spool/uucppublic; its login shell must be uucico.
  14364.  
  14365.  
  14366.  
  14367.  
  14368.  
  14369.  
  14370.  
  14371.  
  14372.                                  - 218 -
  14373.  
  14374.  
  14375.  
  14376.            If  you  have  the shadow password suite installed, you can do this
  14377.       with the useradd command:
  14378.  
  14379.  
  14380.  
  14381.            # useradd -d /var/spool/uucppublic -G uuguest -s /usr/lib/uucp/uucico Upablo
  14382.  
  14383.  
  14384.  
  14385.  
  14386.            If  you  don't  use the shadow password suite, you probably have to
  14387.       edit /etc/passwd by hand, adding a line like  that  shown  below,  where
  14388.       5000  and  150 are the numerical uid and gid assigned to user Upablo and
  14389.       group uuguest, respectively.
  14390.  
  14391.  
  14392.  
  14393.            Upablo:x:5000:150:UUCP Account:/var/spool/uucppublic:/usr/lib/uucp/uucico
  14394.  
  14395.  
  14396.  
  14397.  
  14398.            After  installing  the  account, you have to activate it by setting
  14399.       its password with the passwd command.
  14400.  
  14401.  
  14402.            To serve UUCP systems that connect to your site over TCP, you  have
  14403.       to set up inetd to handle incoming connections on the uucp port.  You do
  14404.       this by adding the following line to /etc/inetd.conf:(12)
  14405.  
  14406.  
  14407.  
  14408.            uucp   stream  tcp   nowait  root  /usr/sbin/tcpd  /usr/lib/uucp/uucico -l
  14409.  
  14410.  
  14411.  
  14412.  
  14413.             The -l option makes uucico perform its own login authorization. It
  14414.       will prompt for a login name and a password just like the standard login
  14415.       program,  but  will  rely  on  its  private password database instead of
  14416.       /etc/passwd.  This private password file is  named  /usr/lib/uucp/passwd
  14417.       and contains pairs of login names and passwords:
  14418.  
  14419.  
  14420.  
  14421.            Upablo  IslaNegra
  14422.            Ulorca  co'rdoba
  14423.  
  14424.  
  14425.  
  14426.  
  14427.  
  14428.       
  14429.  
  14430.       12.Note that usually, tcpd has mode 700, so  that  you  must
  14431.          invoke it as user root, not uucp as you would usually do.
  14432.  
  14433.  
  14434.  
  14435.  
  14436.  
  14437.  
  14438.  
  14439.                                  - 219 -
  14440.  
  14441.  
  14442.  
  14443.            Of  course, this file must be owned by uucp and have permissions of
  14444.       600.
  14445.  
  14446.  
  14447.             If this database sounds like such a good idea you  would  like  to
  14448.       use  on normal serial logins, too, you will be disappointed to hear that
  14449.       this isn't possible at the moment without major contortions. First  off,
  14450.       you  need Taylor UUCP 1.05 for this, because it allows getty to pass the
  14451.       login  name of the calling user to uucico using the -u option.(13) Then,
  14452.       you have to trick the getty you are using into invoking  uucico  instead
  14453.       of  the  usual /bin/login. With getty ps, you can do this by setting the
  14454.       LOGIN option in the configuration file. However, this disables  interac-
  14455.       tive  logins  altogether.  mgetty, on the other hand, has a nice feature
  14456.       that allows you to invoke different login commands based on the name the
  14457.       user  provided.  For instance, you can tell mgetty to use uucico for all
  14458.       users that provide a login name beginning with  a  capital  U,  but  let
  14459.       everyone else be handled by the standard login command.
  14460.  
  14461.  
  14462.            To  protect your UUCP users from callers giving a false system name
  14463.       and snarfing all their mail, you should  add  called-login  commands  to
  14464.       each  system  entry in the sys file. This is described in section 13.5.3
  14465.       above.
  14466.  
  14467.  
  14468.  
  14469.  
  14470.  
  14471.       13.5.3  Protecting Yourself Against Swindlers
  14472.  
  14473.  
  14474.  
  14475.  
  14476.            One of the biggest problems about UUCP is that the  calling  system
  14477.       can lie about its name; it announces its name to the called system after
  14478.       logging in, but the server doesn't have a way to check  this.  Thus,  an
  14479.       attacker could log into his or her own UUCP account, pretend to be some-
  14480.       one else, and pick up that other site's mail. This is particularly trou-
  14481.       blesome  if  you  offer  login via anonymous UUCP, where the password is
  14482.       made public.
  14483.  
  14484.  
  14485.            Unless you know you can trust all sites that call your system to be
  14486.       honest,  you must guard against this sort of impostors. The cure against
  14487.       this disease is to require each system to use a particular login name by
  14488.       specifying  a  called-login  in sys. A sample system entry may look like
  14489.       this:
  14490.  
  14491.  
  14492.  
  14493.  
  14494.       
  14495.  
  14496.       13.The -u option is present in 1.04, too, but is only a  no-
  14497.          op.
  14498.  
  14499.  
  14500.  
  14501.  
  14502.  
  14503.  
  14504.  
  14505.                                  - 220 -
  14506.  
  14507.  
  14508.  
  14509.            system          pablo
  14510.            called-login    Upablo
  14511.  
  14512.  
  14513.  
  14514.  
  14515.            The upshot of this is that whenever a system logs in  and  pretends
  14516.       it is pablo, uucico will check whether it has logged in as Upablo. If it
  14517.       hasn't, the calling system will be turned down, and  the  connection  is
  14518.       dropped.  You  should make it a habit to add the called-login command to
  14519.       every system entry you add to your sys file. It is important that you do
  14520.       this for all sytems, regardless of whether they will ever call your site
  14521.       or not. For those sites that never call you,  you  should  probably  set
  14522.       called-login to some totally bogus user name, such as neverlogsin.
  14523.  
  14524.  
  14525.       13.5.4  Be Paranoid -- Call Sequence Checks
  14526.  
  14527.  
  14528.  
  14529.  
  14530.            Another  way  to  fend  off  and  detect  impostors  is to use call
  14531.       sequence checks.  Call sequence checks help you protect against  intrud-
  14532.       ers that somehow managed to find out the password you log into your UUCP
  14533.       system with.
  14534.  
  14535.  
  14536.            When using call sequence checks, both machines keep  track  of  the
  14537.       number  of  connections  established so far. It is incremented with each
  14538.       connection.  After logging in, the caller sends its call  sequence  num-
  14539.       ber,  and  the  callee  checks  it against its own number. If they don't
  14540.       match, the connection attempt will be rejected. If the initial number is
  14541.       chosen  at  random, attackers will have a hard time guessing the correct
  14542.       call sequence number.
  14543.  
  14544.  
  14545.            But call sequence checks do more for you than this:  even  if  some
  14546.       very  clever  person  should detect your call sequence number as well as
  14547.       your password, you will find this out. When the attacker call your  UUCP
  14548.       feed  and  steals  your mail, this will increase the feeds call sequence
  14549.       number by one.  The next time you call your feed and try to log in,  the
  14550.       remote  uucico will refuse you, because the numbers don't match anymore!
  14551.  
  14552.  
  14553.            If you have enabled call sequence checks, you should check your log
  14554.       files  regularly  for  error messages that hint at possible attacks.  If
  14555.       your system rejects the call sequence number the calling  system  offers
  14556.       it,  uucico  will  put a message into the log file saying something like
  14557.       ``Out of sequence call rejected''. If your system  is  rejected  by  its
  14558.       feed because the sequence numbers are out of sync, it will put a message
  14559.       in the log file saying ``Handshake failed (RBADSEQ)''.
  14560.  
  14561.  
  14562.            To enable call sequence checks, you have to add  following  command
  14563.  
  14564.  
  14565.  
  14566.  
  14567.  
  14568.  
  14569.  
  14570.  
  14571.                                  - 221 -
  14572.  
  14573.  
  14574.  
  14575.       to the system entry:
  14576.  
  14577.  
  14578.  
  14579.            # enable call sequence checks
  14580.            sequence        true
  14581.  
  14582.  
  14583.  
  14584.  
  14585.            Beside this, you have to create the file  containing  the  sequence
  14586.       number  itself.   Taylor  UUCP  keeps  the  sequence number is in a file
  14587.       called .Sequence in the remote site's spool directory. It must be  owned
  14588.       by  uucp,  and  must  be  mode  600 (i.e. readable and writeable only by
  14589.       uucp).  It is best to initialize this file with  an  arbitrary,  agreed-
  14590.       upon start value.  Otherwise, an attacker might manage to guess the num-
  14591.       ber by trying out all values smaller than, say, 60.
  14592.  
  14593.  
  14594.  
  14595.            # cd /var/spool/uucp/pablo
  14596.            # echo 94316 > .Sequence
  14597.            # chmod 600 .Sequence
  14598.            # chown uucp.uucp .Sequence
  14599.  
  14600.  
  14601.  
  14602.  
  14603.            Of course, the remote site has to enable call  sequence  checks  as
  14604.       well, and start by using exactly the same sequence number as you.
  14605.  
  14606.  
  14607.  
  14608.  
  14609.  
  14610.  
  14611.  
  14612.  
  14613.  
  14614.  
  14615.  
  14616.       13.5.5  Anonymous UUCP
  14617.  
  14618.  
  14619.  
  14620.  
  14621.            If  you  want  to provide anonymous UUCP access to your system, you
  14622.       first have to set up a special account for it  as  described  above.   A
  14623.       common practive is to give it a login name and a password of uucp.
  14624.  
  14625.  
  14626.            In  addition,  you  have  to  set a few of the security options for
  14627.       unknown systems. For instance, you may want to prohibit them  from  exe-
  14628.       cuting  any  commands  on  your  system.  However,  you cannot set these
  14629.  
  14630.  
  14631.  
  14632.  
  14633.  
  14634.  
  14635.  
  14636.  
  14637.                                  - 222 -
  14638.  
  14639.  
  14640.  
  14641.       parameters in a sys file entry, because the system command requires  the
  14642.       system's  name,  which  you  don't have. Taylor UUCP solves this dilemma
  14643.       through the unknown command. unknown can be used in the config  file  to
  14644.       specify any command that can usually appear in a system entry:
  14645.  
  14646.  
  14647.  
  14648.            unknown         remote-receive ~/incoming
  14649.            unknown         remote-send ~/pub
  14650.            unknown         max-remote-debug none
  14651.            unknown         command-path /usr/lib/uucp/anon-bin
  14652.            unknown         commands rmail
  14653.  
  14654.  
  14655.  
  14656.  
  14657.            This  will restrict unknown systems to downloading files from below
  14658.       the pub directory and uploading files to the  incoming  directory  below
  14659.       /var/spool/uucppublic.  The  next  line  will  make  uucico  ignore  any
  14660.       requests from the remote system to turn on debugging locally.  The  last
  14661.       two  lines permit unknown systems to execute rmail; but the command path
  14662.       specified makes uucico look for the rmail command in a private directory
  14663.       named anon-bin only. This allows you to provide some special rmail that,
  14664.       for instance, forwards all mail to the super-user for examination.  This
  14665.       allows  anonymous  users to reach the maintainer of the system, but pre-
  14666.       vents them at the same time from injecting any mail to other sites.
  14667.  
  14668.  
  14669.            To enable anonymous UUCP, you must specify  at  least  one  unknown
  14670.       statement in config. Otherwise uucico will reject any unknown systems.
  14671.  
  14672.  
  14673.  
  14674.  
  14675.  
  14676.       13.6  UUCP Low-Level Protocols
  14677.  
  14678.  
  14679.  
  14680.  
  14681.            To  negotiate  session  control  and file transfers with the remote
  14682.       end, uucico uses a set of standardized messages. This is often  referred
  14683.       to  as  the high-level protocol. During the initialization phase and the
  14684.       hangup phase these are simply sent across as  strings.  However,  during
  14685.       the  real  transfer  phase, an additional low-level protocol is employed
  14686.       which is mostly transparent to the higher levels. This is to make  error
  14687.       checks possible when using unreliable lines, for instance.
  14688.  
  14689.  
  14690.       13.6.1  Protocol Overview
  14691.  
  14692.  
  14693.  
  14694.  
  14695.  
  14696.  
  14697.  
  14698.  
  14699.  
  14700.  
  14701.  
  14702.  
  14703.                                  - 223 -
  14704.  
  14705.  
  14706.  
  14707.            As UUCP is used over different types of connections, such as serial
  14708.       lines or TCP, or even X.25, specific low-level protocols are needed.  In
  14709.       addition, several implementations of UUCP have introduced different pro-
  14710.       tocols that do roughly the same thing.
  14711.  
  14712.  
  14713.            Protocols can be divided into two categories: streaming and packet-
  14714.       oriented protocols. Protocols of the latter variety transfer a file as a
  14715.       whole, possibly computing a checksum over it. This is nearly free of any
  14716.       overhead,  but  requires  a  reliable connection, because any error will
  14717.       cause the whole file to be retransmitted. These protocols  are  commonly
  14718.       used  over  TCP connections, but are not suitable for use over telephone
  14719.       lines.  Although modern modems do quite a good job at error  correction,
  14720.       they are not perfect, nor is there any error detection between your com-
  14721.       puter and the modem.
  14722.  
  14723.  
  14724.            On the other hand, packet protocols split up the file into  several
  14725.       chunks  of  equal  size.  Each packet is sent and received separately, a
  14726.       checksum is computed, and an acknowledgement is returned to the  sender.
  14727.       To  make  this  more  efficient, sliding-window protocols were invented,
  14728.       which allow for a limited number (a window) of  outstanding  acknoledge-
  14729.       ments  at  any time.  This greatly reduces the amount of time uucico has
  14730.       to wait during a transmission.  Still,  the  relatively  large  overhead
  14731.       compared  to  a  streaming protocol make packet protocls inefficient for
  14732.       use over TCP.
  14733.  
  14734.  
  14735.            The width of the data path  also  makes  a  difference.  Sometimes,
  14736.       sending eight-bit characters over a serial connection is impossible, for
  14737.       instance if the connection goes through a stupid  terminal  server.   In
  14738.       this  case,  characters  with  the  eighth  bit set have to be quoted on
  14739.       transmission.  When you transmit eight-bit characters over  a  seven-bit
  14740.       connection,  they  have to be Under worst-case assumptions, this doubles
  14741.       the amount of data to be transmitted, although compression done  by  the
  14742.       hardware  may  compensate  for  this.  Lines that can transmit arbitrary
  14743.       eight-bit characters are usually called eight-bit  clean.  This  is  the
  14744.       case for all TCP connections, as well as for most modem connections.
  14745.  
  14746.  
  14747.            The following protocols are available with Taylor UUCP 1.04:
  14748.  
  14749.  
  14750.  
  14751.  
  14752.               g This  is  the most common protocol and should be understood by
  14753.                 virtually all uucico's. It does thorough error checking and is
  14754.                 therefore  well-suited  for noisy telephone links.  g requires
  14755.                 an eight-bit clean connection.  It is a packet-oriented proto-
  14756.                 col which uses a sliding-window technique.
  14757.  
  14758.  
  14759.               i This  is  a  bidirectional  packet protocol which can send and
  14760.                 receive files at the same  time.  It  requires  a  full-duplex
  14761.  
  14762.  
  14763.  
  14764.  
  14765.  
  14766.  
  14767.  
  14768.  
  14769.                                  - 224 -
  14770.  
  14771.  
  14772.  
  14773.                 connection  and  an eight-bit clean data path. It is currently
  14774.                 understood only by Taylor UUCP.
  14775.  
  14776.  
  14777.               t This is a protocol intended for use over a TCP connection,  or
  14778.                 other  truly  error-free  networks.   It  uses packets of 1024
  14779.                 bytes and requires an eight-bit clean connection.
  14780.  
  14781.  
  14782.               e This should basically do the same as t. The main difference is
  14783.                 that e is a streaming protocol.
  14784.  
  14785.  
  14786.               f This  is  intended for use with reliable X.25 connections.  It
  14787.                 is a streaming protocol and expects  a  seven-bit  data  path.
  14788.                 Eight-bit  characters are quoted, which can make it very inef-
  14789.                 ficient.
  14790.  
  14791.  
  14792.               G This is the System V Release 4 version of the g protocol.   It
  14793.                 is also understood by some other versions of UUCP.
  14794.  
  14795.  
  14796.               a This  protocol is similiar to ZMODEM. It requires an eight bit
  14797.                 connection, but quotes certain control characters like XON and
  14798.                 XOFF.
  14799.  
  14800.  
  14801.  
  14802.  
  14803.  
  14804.       13.6.2  Tuning the Transmission Protocol
  14805.  
  14806.  
  14807.  
  14808.  
  14809.            All  protocols  allow for some variation in packet sizes, timeouts,
  14810.       and the like.  Usually, the defaults provided work well  under  standard
  14811.       circumstances,  but may not be optimal for your situation.  The g proto-
  14812.       col, for instance, uses window sizes from 1 to 7, and  packet  sizes  in
  14813.       powers of 2 ranging from 64 through 4096.(14) If your telephone line  is
  14814.       usually  so  noisy  that  it  drops more than 5 percent all packets, you
  14815.       should probably lower the packet size and shrink  the  window.   On  the
  14816.       other  hand, on very good telephone lines the protocol overhead of send-
  14817.       ing ACKs for every 128 bytes may  prove  wasteful,  so  that  you  might
  14818.       increase the packet size to 512 or even 1024.
  14819.  
  14820.  
  14821.            Taylor  UUCP  provides  a  meachanism  to suit your needs by tuning
  14822.       these parameters with the protocol-parameter command in  the  sys  file.
  14823.       For instance, to set the g protocol's packet size to 512 when talking to
  14824.  
  14825.       
  14826.  
  14827.       14.Most  binaries included in Linux distributions default to
  14828.          a window size of 7 and 128 byte packets.
  14829.  
  14830.  
  14831.  
  14832.  
  14833.  
  14834.  
  14835.  
  14836.                                  - 225 -
  14837.  
  14838.  
  14839.  
  14840.       pablo, you have to add:
  14841.  
  14842.  
  14843.  
  14844.            system          pablo
  14845.            protocol-parameter g  packet-size  512
  14846.  
  14847.  
  14848.  
  14849.  
  14850.            The tunable parameters and their names vary from protocol to proto-
  14851.       col.  For a complete list of them  please  refer  to  the  documentation
  14852.       enclosed in the Taylor UUCP source.
  14853.  
  14854.  
  14855.       13.6.3  Selecting Specific Protocols
  14856.  
  14857.  
  14858.  
  14859.  
  14860.            Not  every implementation of uucico speaks and understand each pro-
  14861.       tocol, so during the initial handshake phase,  both  processes  have  to
  14862.       agree  on  a common protocol.  The master uucico offers the slave a list
  14863.       of supported protocols by sending Pprotlist, from which  the  slave  may
  14864.       pick one.
  14865.  
  14866.  
  14867.            Based on the type of port used (modem, TCP, or direct), uucico will
  14868.       compose a default list of protocols. For modem and  direct  connections,
  14869.       this list usually comprises i, a, g, G, and j.  For TCP connections, the
  14870.       list is t, e, i, a, g, G, j, and f. You can override this  default  list
  14871.       with  the protocols command, which may be specified in a system entry as
  14872.       well as a port entry. For instance, you might edit the port  file  entry
  14873.       for your modem port like this:
  14874.  
  14875.  
  14876.  
  14877.            port            serial1
  14878.            protocols       igG
  14879.  
  14880.  
  14881.  
  14882.  
  14883.            This  will require any incoming or outgoing connection through this
  14884.       port to use i, g, or G. If the remote system does  not  support  any  of
  14885.       these, the conversation will fail.
  14886.  
  14887.  
  14888.  
  14889.  
  14890.  
  14891.       13.7  Troubleshooting
  14892.  
  14893.  
  14894.  
  14895.  
  14896.  
  14897.  
  14898.  
  14899.  
  14900.  
  14901.  
  14902.                                  - 226 -
  14903.  
  14904.  
  14905.  
  14906.            This section describes what may go wrong with your UUCP connection,
  14907.       and makes suggestions where to look for the error.  However,  the  ques-
  14908.       tions  were  compiled off the top of my head. There's much more that can
  14909.       go wrong.
  14910.  
  14911.  
  14912.             In any case, enable debugging with -xall, and take a look  at  the
  14913.       output  in  Debug in the spool directory.  It should help you to quickly
  14914.       recognize where the problem lies.  Also, I have always found it  helpful
  14915.       to  turn  on  my  modem's  speaker  when  it didn't connect. With Hayes-
  14916.       compatible modems, this is accomplished by adding ``ATL1M1 OK''  to  the
  14917.       modem chat in the dial file.
  14918.  
  14919.  
  14920.            The  first  check always should be whether all file permissions are
  14921.       set  correctly.   uucico  should  be  setuid  uucp,  and  all  files  in
  14922.       /usr/lib/uucp, /var/spool/uucp and /var/spool/uucppublic should be owned
  14923.       by  uucp.  There  are  also some hidden files(15) in the spool directory
  14924.       which must be owned by uucp as well.
  14925.  
  14926.  
  14927.            uucico keeps saying ``Wrong time to  call'':  This  probably  means
  14928.       that  in the system entry in sys, you didn't specify a time command that
  14929.       details when the remote system may be called,  or  you  gave  one  which
  14930.       actually  forbids  calling  at  the current time. If no call schedule is
  14931.       given, uucico assumes that the system may never be called.
  14932.  
  14933.  
  14934.            uucico complains that the site is already locked: This  means  that
  14935.       uucico  detected  a  lock file for the remote system in /var/spool/uucp.
  14936.       The lock file may be from an earlier call to the system that crashed, or
  14937.       was  killed.  However, it's also likely that there's another uucico pro-
  14938.       cess sitting around that is trying to dial the  remote  system  and  got
  14939.       stuck  in  a chat script, etc. If this uucico process doesn't succeed in
  14940.       connecting to the remote system, kill  it  with  a  hangup  signal,  and
  14941.       remove any lock files it left lying around.
  14942.  
  14943.  
  14944.            I  can  connect to the remote site, but the chat script fails: Look
  14945.       at the text you receive from the remote  site.  If  it's  garbled,  this
  14946.       might  be  a  speed-related  problem.   Otherwise,  confirm if it really
  14947.       agrees with what your chat script expects.  Remember,  the  chat  script
  14948.       starts with an expect string. If you receive the login prompt, then send
  14949.       your name, but never get the password prompt, insert some delays  before
  14950.       sending  it,  or  even in-between the letters. You might be too fast for
  14951.       your modem.
  14952.  
  14953.  
  14954.            My modem does not dial: If your modem doesn't indicate that the DTR
  14955.       line  has  been raised when uucico calls out, you possibly haven't given
  14956.       the right device to uucico. If your modem recognizes DTR, check  with  a
  14957.  
  14958.       
  14959.  
  14960.       15.That is, files whose name begins with a dot.  Such  files
  14961.          aren't normally displayed by the ls command.
  14962.  
  14963.  
  14964.  
  14965.  
  14966.  
  14967.  
  14968.  
  14969.                                  - 227 -
  14970.  
  14971.  
  14972.  
  14973.       terminal  program that you can write to it. If this works, turn on echo-
  14974.       ing with \E at the start of the modem chat. If it doesn't echo your com-
  14975.       mands during the modem chat, check if your line speed is too high or low
  14976.       for your modem. If you see the echo, check if you  have  disabled  modem
  14977.       responses,  or  set  them  to number codes.  Verify that the chat script
  14978.       itself is correct. Remember that you have to write  two  backslashes  to
  14979.       send one to the modem.
  14980.  
  14981.  
  14982.            My  modem  tries  to dial, but doesn't get out: Insert a delay into
  14983.       the phone number. This is especially useful when dialing out from a com-
  14984.       pany's  internal  telephone net.  For people in Europe, who usually dial
  14985.       pulse-tone, try touch-tone.  In some  countries,  postal  services  have
  14986.       been upgrading their nets recently. Touch-tone sometimes helps.
  14987.  
  14988.  
  14989.            I log file says I have extremely high packet loss rates: This looks
  14990.       like a speed problem. Maybe the link between computer and modem  is  too
  14991.       slow  (remember  to adapt it to the highest effective rate possible)? Or
  14992.       is it your hardware that is too slow to service interrupts in time? With
  14993.       a  NSC  16550A chipset on your serial port, 38kbps are said to work rea-
  14994.       sonably well; however, without FIFOs (like 16450 chips), 9600 bps is the
  14995.       limit.  Also,  you should make sure hardware handshake is enabled on the
  14996.       serial line.
  14997.  
  14998.  
  14999.            Another likely cause is that hardware handshake  isn't  enabled  on
  15000.       the  port.   Taylor  UUCP  1.04 has no provisions for turning on RTS/CTS
  15001.       handshake.  You have to enable this explicitly from rc.serial using  the
  15002.       following command:
  15003.  
  15004.  
  15005.  
  15006.            $ stty crtscts < /dev/cua3
  15007.  
  15008.  
  15009.  
  15010.  
  15011.            I  can  log in, but handshake fails: Well, there can be a number of
  15012.       problems. The output in the log file should tell you a lot. Look at what
  15013.       protocols the remote site offers (It sends a string Pprotlist during the
  15014.       handshake).  Maybe they don't have any in common  (did  you  select  any
  15015.       protocols in sys or port?).
  15016.  
  15017.  
  15018.            If  the remote system sends RLCK, there is a stale lockfile for you
  15019.       on the remote system. If it's not because you're  already  connected  to
  15020.       the remote system on a different line, ask to have it removed.
  15021.  
  15022.  
  15023.            If  it  sends RBADSEQ, the other site has conversation count checks
  15024.       enabled for you, but numbers didn't match. If it sends RLOGIN, you  were
  15025.       not permitted to login under this id.
  15026.  
  15027.  
  15028.  
  15029.  
  15030.  
  15031.  
  15032.  
  15033.  
  15034.  
  15035.                                  - 228 -
  15036.  
  15037.  
  15038.  
  15039.       13.8  Log Files
  15040.  
  15041.  
  15042.  
  15043.  
  15044.            When compiling the UUCP suite to use Taylor-style logging, you have
  15045.       only three global log files, all of which reside in the spool directory.
  15046.       The  main  log file is named Log and contains all information about con-
  15047.       nections established and files transferred. A typical excerpt looks like
  15048.       this (after a little reformatting to make it fit the page):
  15049.  
  15050.  
  15051.  
  15052.            uucico pablo - (1994-05-28 17:15:01.66 539) Calling system pablo (port cua3)
  15053.            uucico pablo - (1994-05-28 17:15:39.25 539) Login successful
  15054.            uucico pablo - (1994-05-28 17:15:39.90 539) Handshake successful
  15055.                           (protocol 'g' packet size 1024 window 7)
  15056.            uucico pablo postmaster (1994-05-28 17:15:43.65 539) Receiving D.pabloB04aj
  15057.            uucico pablo postmaster (1994-05-28 17:15:46.51 539) Receiving X.pabloX04ai
  15058.            uucico pablo postmaster (1994-05-28 17:15:48.91 539) Receiving D.pabloB04at
  15059.            uucico pablo postmaster (1994-05-28 17:15:51.52 539) Receiving X.pabloX04as
  15060.            uucico pablo postmaster (1994-05-28 17:15:54.01 539) Receiving D.pabloB04c2
  15061.            uucico pablo postmaster (1994-05-28 17:15:57.17 539) Receiving X.pabloX04c1
  15062.            uucico pablo - (1994-05-28 17:15:59.05 539) Protocol 'g' packets: sent 15,
  15063.                            resent 0, received 32
  15064.            uucico pablo - (1994-05-28 17:16:02.50 539) Call complete (26 seconds)
  15065.            uuxqt pablo postmaster (1994-05-28 17:16:11.41 546) Executing X.pabloX04ai
  15066.                           (rmail okir)
  15067.            uuxqt pablo postmaster (1994-05-28 17:16:13.30 546) Executing X.pabloX04as
  15068.                           (rmail okir)
  15069.            uuxqt pablo postmaster (1994-05-28 17:16:13.51 546) Executing X.pabloX04c1
  15070.                           (rmail okir)
  15071.  
  15072.  
  15073.  
  15074.  
  15075.             The next important log file is Stats, which  lists  file  transfer
  15076.       statistics.   The  section  of Stats corresponding to the above transfer
  15077.       looks like this:
  15078.  
  15079.  
  15080.  
  15081.  
  15082.  
  15083.  
  15084.  
  15085.  
  15086.  
  15087.  
  15088.  
  15089.  
  15090.  
  15091.  
  15092.  
  15093.  
  15094.  
  15095.  
  15096.  
  15097.  
  15098.  
  15099.  
  15100.  
  15101.                                  - 229 -
  15102.  
  15103.  
  15104.  
  15105.            postmaster pablo (1994-05-28 17:15:44.78)
  15106.                              received 1714 bytes in 1.802 seconds (951 bytes/sec)
  15107.            postmaster pablo (1994-05-28 17:15:46.66)
  15108.                              received 57 bytes in 0.634 seconds (89 bytes/sec)
  15109.            postmaster pablo (1994-05-28 17:15:49.91)
  15110.                              received 1898 bytes in 1.599 seconds (1186 bytes/sec)
  15111.            postmaster pablo (1994-05-28 17:15:51.67)
  15112.                              received 65 bytes in 0.555 seconds (117 bytes/sec)
  15113.            postmaster pablo (1994-05-28 17:15:55.71)
  15114.                              received 3217 bytes in 2.254 seconds (1427 bytes/sec)
  15115.            postmaster pablo (1994-05-28 17:15:57.31)
  15116.                              received 65 bytes in 0.590 seconds (110 bytes/sec)
  15117.  
  15118.  
  15119.  
  15120.  
  15121.            Again, the lines have been split to make it fit the page.
  15122.  
  15123.  
  15124.            The third file if Debug. This is the place where debugging informa-
  15125.       tion is written. If you use debugging, you should make  sure  that  this
  15126.       file  has  a  protection  mode  of  600. Depending on the debug mode you
  15127.       selected, it may contain the login and password you use  to  connect  to
  15128.       the remote system.
  15129.  
  15130.  
  15131.              Some UUCP binaries included in Linux distributions have been com-
  15132.       piled to use HDB-style logging. HDB UUCP uses a whole bunch of log files
  15133.       stored  below  /var/spool/uucp/.Log.  This directory contains three more
  15134.       directories, named uucico, uuxqt, and uux.   They  contain  the  logging
  15135.       output generated by each of the corresponding commands, sorted into dif-
  15136.       ferent files for each site. Thus, output from uucico when  calling  site
  15137.       pablo  will  go  into  .Log/uucico/pablo, while the subsequent uuxqt run
  15138.       will write to .Log/uuxqt/pablo. The lines written to the various lofiles
  15139.       are however the same as with Taylor logging.
  15140.  
  15141.  
  15142.            When  you  enable  debugging output with HDB-style logging compiled
  15143.       in, it will go to the .Admin  directory  below  /var/spool/uucp.  During
  15144.       outgoing    calls,    debugging    information    will    be   sent   to
  15145.       .Admin/audit.local, while the output from uucico when someone  calls  in
  15146.       will go to .Admin/audit.
  15147.  
  15148.  
  15149.  
  15150.  
  15151.  
  15152.  
  15153.  
  15154.  
  15155.  
  15156.  
  15157.  
  15158.  
  15159.  
  15160.  
  15161.  
  15162.  
  15163.  
  15164.  
  15165.  
  15166.  
  15167.                                  - 230 -
  15168.  
  15169.  
  15170.  
  15171.       14.  Electronic Mail
  15172.  
  15173.  
  15174.  
  15175.  
  15176.            One  of  the most prominent uses of networking since the first net-
  15177.       works were devised, has been eletronic mail.  It  started  as  a  simple
  15178.       service  that copied a file from one machine to another, and appended it
  15179.       to the recipient's mailbox file. Basically, this is still what email  is
  15180.       all  about,  although  an  ever  growing  net  with  its complex routing
  15181.       requirements and its ever increasing load of messages has  made  a  more
  15182.       elaborate scheme necessary.
  15183.  
  15184.  
  15185.             Various standards of mail exchange have been devised. Sites on the
  15186.       Internet adhere to one laid out in RFC 822, augmented by some RFCs  that
  15187.       describe  a  machine-independent way of transferring special characters,
  15188.       and the like. Much thought has also been given recently to ``multi-media
  15189.       mail'',  which deals with including pictures and sound in mail messages.
  15190.       Another standard, X.400, has been defined by CCITT.
  15191.  
  15192.  
  15193.             Quite a number of mail transport programs  have  been  implemented
  15194.       for  Un*x systems. One of the best-known is the University of Berkeley's
  15195.       sendmail, which is used on a number of platforms.  The  original  author
  15196.       was Eric Allman, who is now actively working on the sendmail team again.
  15197.       There are two Linux ports of sendmail-5.56c available, one of which will
  15198.       be described in chapter 16.. The sendmail version currently being devel-
  15199.       oped is 8.6.5.
  15200.  
  15201.  
  15202.             The mail agent most commonly  used  with  Linux  is  smail-3.1.28,
  15203.       written  and copyrighted by Curt Landon Noll and Ronald S. Karr. This is
  15204.       the one included in most Linux distributions.  In the following, we will
  15205.       refer  to  it  simply  as smail, although there are other versions of it
  15206.       which are entirely different, and which we don't describe here.
  15207.  
  15208.  
  15209.            Compared to sendmail, smail is rather young. When handling mail for
  15210.       a  small  site without complicated routing requirements, their capabili-
  15211.       ties are pretty close. For large sites, however, sendmail  always  wins,
  15212.       because its configuration scheme is much more flexible.
  15213.  
  15214.  
  15215.            Both  smail  and sendmail support a set of configuration files that
  15216.       have to be customized. Apart from the information that  is  required  to
  15217.       make the mail subsystem run (such as the local hostname), there are many
  15218.       more parameters that may be tuned.  sendmail's main  configuration  file
  15219.       is very hard to understand at first. It looks as if your cat had taken a
  15220.       nap on your keyboard with the shift key  pressed.   smail  configuration
  15221.       files  are more structured and easier to understand than sendmail's, but
  15222.       don't give the user as much power in tuning the mailer's behavior.  How-
  15223.       ever,  for  small UUCP or Internet sites the work required in setting up
  15224.       any of them is roughly the same.
  15225.  
  15226.  
  15227.  
  15228.  
  15229.  
  15230.  
  15231.  
  15232.  
  15233.                                  - 231 -
  15234.  
  15235.  
  15236.  
  15237.            In this chapter, we will deal with what email is  and  what  issues
  15238.       you  as  an  administrator will have to deal with.  Chapters 15. and 16.
  15239.       will give instructions on setting up smail and sendmail  for  the  first
  15240.       time.   The  information  provided  there  should suffice to get smaller
  15241.       sites operational, but there are many more options, and  you  can  spend
  15242.       many happy hours in front of your computer configuring the fanciest fea-
  15243.       tures.
  15244.  
  15245.  
  15246.            Toward the end of the current chapter we will briefly cover setting
  15247.       up elm, a very common mail user agent on many Un*xish systems, including
  15248.       Linux.
  15249.  
  15250.  
  15251.            For more information about issues specific to  electronic  mail  on
  15252.       Linux,  please refer to the Electronic Mail HOWTO by Vince Skahan, which
  15253.       is posted to comp.os.linux.announce regularly.  The source distributions
  15254.       of  elm,  smail  and  sendmail also contain very extensive documentation
  15255.       that should answer most of your questions on setting them  up.   If  you
  15256.       are  looking  for  information  on email in general, there's a number of
  15257.       RFCs that deal with this topic. They are listed in the  bibliography  at
  15258.       the end of the book.
  15259.  
  15260.  
  15261.       14.1  What is a Mail Message?
  15262.  
  15263.  
  15264.  
  15265.  
  15266.            A  Mail  message generally consists of a message body, which is the
  15267.       text the sender wrote, and special data specifying recipients, transport
  15268.       medium,  etc.,  very  much like what you see when you look at a letter's
  15269.       envelope.
  15270.  
  15271.  
  15272.            This administrative data falls into two categories;  in  the  first
  15273.       category  is any data that is specific to the transport medium, like the
  15274.       address of sender and recipient. It is therefore  called  the  envelope.
  15275.       It may be transformed by the transport software as the message is passed
  15276.       along.
  15277.  
  15278.  
  15279.            The second variety is any data necessary for handling the mail mes-
  15280.       sage,  which  is  not particular to any transport mechanism, such as the
  15281.       message's subject line, a list of all recipients, and the date the  mes-
  15282.       sage was sent.  In many networks, it has become standard to prepend this
  15283.       data to the mail message, forming the so-called mail header.  It is off-
  15284.       set from the mail body by an empty line.(1)
  15285.  
  15286.  
  15287.       
  15288.  
  15289.       1. It  is  customary to append a signature or .sig to a mail
  15290.          message, usually containing information  on  the  author,
  15291.          along  with a joke or a motto. It is offset from the mail
  15292.          message by a line containing ``-- ''.
  15293.  
  15294.  
  15295.  
  15296.  
  15297.  
  15298.  
  15299.  
  15300.                                  - 232 -
  15301.  
  15302.  
  15303.  
  15304.            Most mail transport software in the Un*x world uses a header format
  15305.       outlined  in  a RFC 822.  Its original purpose was to specify a standard
  15306.       for use on the ARPANET, but since it was designed to be independent from
  15307.       any environment, it has been easily adapted to other networks, including
  15308.       many UUCP-based networks.
  15309.  
  15310.  
  15311.            RFC 822 however is  only  the  greatest  common  denominator.  More
  15312.       recent  standards have been conceived to cope with growing needs as, for
  15313.       example, data  encryption,  international  character  set  support,  and
  15314.       multi-media mail extensions (MIME).
  15315.  
  15316.  
  15317.            In all these standards, the header consists of several lines, sepa-
  15318.       rated by newline characters. A line is made up of a field  name,  begin-
  15319.       ning  in  column  one, and the field itself, offset by a colon and white
  15320.       space. The format and semantics of each  field  vary  depending  on  the
  15321.       field  name.  A  header  field may be continued across a newline, if the
  15322.       next line begins with a TAB.  Fields can appear in any order.
  15323.  
  15324.  
  15325.            A typical mail header may look like this:
  15326.  
  15327.  
  15328.  
  15329.            From brewhq.swb.de!ora.com!andyo Wed Apr 13 00:17:03 1994
  15330.            Return-Path: <brewhq.swb.de!ora.com!andyo>
  15331.            Received: from brewhq.swb.de by monad.swb.de with uucp
  15332.                    (Smail3.1.28.1 #6) id m0pqqlT-00023aB; Wed, 13 Apr 94 00:17 MET DST
  15333.            Received: from ora.com (ruby.ora.com) by brewhq.swb.de with smtp
  15334.                    (Smail3.1.28.1 #28.6) id <m0pqoQr-0008qhC>; Tue, 12 Apr 94 21:47 MEST
  15335.            Received: by ruby.ora.com (8.6.8/8.6.4) id RAA26438; Tue, 12 Apr 94 15:56 -0400
  15336.            Date: Tue, 12 Apr 1994 15:56:49 -0400
  15337.            Message-Id: <199404121956.PAA07787@ruby>
  15338.            From: andyo@ora.com (Andy Oram)
  15339.            To: okir@monad.swb.de
  15340.            Subject: Re: Your RPC section
  15341.  
  15342.  
  15343.  
  15344.  
  15345.            Usually, all necessary header fields are generated  by  the  mailer
  15346.       interface  you  use,  like  elm,  pine, mush, or mailx. Some however are
  15347.       optional, and may be added by the user.  elm, for example, allows you to
  15348.       edit part of the message header.  Others are added by the mail transport
  15349.       software. A list of common header fields and  their  meaning  are  given
  15350.       below:
  15351.  
  15352.  
  15353.  
  15354.  
  15355.           From: This  contains  the  sender's  email address, and possibly the
  15356.                 ``real name''. A complete zoo of formats is used here.
  15357.  
  15358.  
  15359.  
  15360.  
  15361.  
  15362.  
  15363.  
  15364.  
  15365.  
  15366.                                  - 233 -
  15367.  
  15368.  
  15369.  
  15370.             To: This is the recipient's email address.
  15371.  
  15372.  
  15373.        Subject: Describes the content of the mail in a  few  words.  At  least
  15374.                 that's what it should do.
  15375.  
  15376.  
  15377.           Date: The date the mail was sent.
  15378.  
  15379.  
  15380.       Reply-To: Specifies  the  address the sender wants the recipient's reply
  15381.                 directed to. This may be useful if you have several  accounts,
  15382.                 but  want  to receive the bulk of mail only on the one you use
  15383.                 most frequently. This field is optional.
  15384.  
  15385.  
  15386.       Organization: The organization that owns the machine from which the mail
  15387.                 originates.  If your machine is owned by you privately, either
  15388.                 leave this out, or insert ``private'' or  some  complete  non-
  15389.                 sense.  This field is optional.
  15390.  
  15391.  
  15392.       Message-ID: A string generated by mail transport on the originating sys-
  15393.                 tem.  It is unique to this message.
  15394.  
  15395.  
  15396.       Received: Every site that processes your mail (including the machines of
  15397.                 sender  and  recipient)  inserts such a field into the header,
  15398.                 giving its site name, a message id, time and date it  received
  15399.                 the  message, which site it is from, and which transport soft-
  15400.                 ware was used. This is so that you can trace which  route  the
  15401.                 message  took,  and  can complain to the person responsible if
  15402.                 something went wrong.
  15403.  
  15404.  
  15405.       X-anything: No mail-related programs should complain  about  any  header
  15406.                 which  starts with X-. It is used to implement additional fea-
  15407.                 tures that have not yet made it into an RFC,  or  never  will.
  15408.                 This is used by the Linux Activists mailing list, for example,
  15409.                 where the channel is selected by the X-Mn-Key: header field.
  15410.  
  15411.  
  15412.  
  15413.  
  15414.  
  15415.            The one exception to this structure is  the  very  first  line.  It
  15416.       starts  with  the keyword From which is followed by a blank instead of a
  15417.       colon.  To distinguish it from the ordinary  From:  field,  it  is  fre-
  15418.       quently  referred  to  as  From .  It contains the route the message has
  15419.       taken in UUCP bang-path style (explained below), time and date  when  it
  15420.       was  received  by  the last machine having processed it, and an optional
  15421.       part specifying which host it was received from.  Since  this  field  is
  15422.       regenerated  by  every system that processes the message, it is somtimes
  15423.       subsumed under the envelope data.
  15424.  
  15425.  
  15426.  
  15427.  
  15428.  
  15429.  
  15430.  
  15431.  
  15432.                                  - 234 -
  15433.  
  15434.  
  15435.  
  15436.            The From  field is there for backward compatibilty with some  older
  15437.       mailers,  but  is not used very much anymore, except by mail user inter-
  15438.       faces that rely on it to mark the beginning of a message in  the  user's
  15439.       mailbox.  To avoid potential trouble with lines in the message body that
  15440.       begin with ``From '', too, it has become standard  procedure  to  escape
  15441.       any such occurence by preceding it with ``>''.
  15442.  
  15443.  
  15444.       14.2  How is Mail Delivered?
  15445.  
  15446.  
  15447.  
  15448.  
  15449.            Generally, you will compose mail using a mailer interface like mail
  15450.       or mailx; or more sophisticated ones like elm, mush, or pine. These pro-
  15451.       grams  are  called  mail  user agents, or MUA's for short. If you send a
  15452.       mail message, the interface program  will  in  most  cases  hand  it  to
  15453.       another  program  for delivery. This is called the mail transport agent,
  15454.       or MTA. On some systems, there are different mail transport  agents  for
  15455.       local  and  remote  delivery; on others, there is only one.  The command
  15456.       for remote delivery is usually called rmail, the other is  called  lmail
  15457.       (if it exists).
  15458.  
  15459.  
  15460.             Local delivery of mail is, of course, more than just appending the
  15461.       incoming message to the recipient's mailxbox.  Usually,  the  local  MTA
  15462.       will  understand aliasing (setting up local recipient addresses pointing
  15463.       to other addresses), and forwarding (redirecting a user's mail  to  some
  15464.       other destination). Also, messages that cannot be delivered must usually
  15465.       be bounced, that is, returned to the sender along with some  error  mes-
  15466.       sage.
  15467.  
  15468.  
  15469.              For  remote  delivery, the transport software used depends on the
  15470.       nature of the link.  If the mail must be delivered over a network  using
  15471.       TCP/IP,  SMTP  is  commonly  used.  SMTP stands for Simple Mail Transfer
  15472.       Protocol, and is defined in RFC 788 and RFC 821.  SMTP usually  connects
  15473.       to  the  recipient's  machine directly, negotiating the message transfer
  15474.       with the remote side's SMTP daemon.
  15475.  
  15476.  
  15477.             In UUCP networks, mail will usually not be delivered directly, but
  15478.       rather  be forwarded to the destination host by a number of intermediate
  15479.       systems. To send a message over a UUCP link, the sending MTA  will  usu-
  15480.       ally  execute  rmail on the forwarding system using uux, and feed it the
  15481.       message on standard input.
  15482.  
  15483.  
  15484.             Since this is done for each message separately, it may  produce  a
  15485.       considerable  work load on a major mail hub, as well as clutter the UUCP
  15486.       spool queues with hundreds of small files taking  up  an  unproportional
  15487.       amount  of  disk space.(2) Some MTAs therefore allow you to collect sev-
  15488.       eral messages for a remote system in a single batch file. The batch file
  15489.       contains the SMTP commands that the local host would normally issue if a
  15490.       direct SMTP connection was used.  This is called BSMTP, or batched SMTP.
  15491.       The  batch  is then fed to the rsmtp or bsmtp program on the remote sys-
  15492.       tem, which will process the input as if a  normal  SMTP  connection  had
  15493.       occurred.
  15494.  
  15495.  
  15496.  
  15497.  
  15498.                                  - 235 -
  15499.  
  15500.  
  15501.  
  15502.  
  15503.  
  15504.  
  15505.       14.3  Email Addresses
  15506.  
  15507.  
  15508.  
  15509.  
  15510.            For  electronic mail, an address is made up of at least the name of
  15511.       a machine handling the person's mail, and a user  identification  recog-
  15512.       nized  by  this  system. This may be the recipient's login name, but may
  15513.       also be anything else. Other mail addressing schemes, like X.400, use  a
  15514.       more general set of ``attributes'' which are used to look up the recipi-
  15515.       ent's host in an X.500 directory server.
  15516.  
  15517.  
  15518.            The way a machine name is interpreted, i.e. at which site your mes-
  15519.       sage will finally wind up, and how to combine this name with the recipi-
  15520.       ent's user name greatly depends on the network you are on.
  15521.  
  15522.  
  15523.            Internet sites adhere to the RFC 822  standard,  which  requires  a
  15524.       notation  of  user@host.domain,  where  host.domain  is the host's fully
  15525.       qualified domain name. The  middle  thing  is  called  an  ``at''  sign.
  15526.       Because  this  notation does not involve a route to the destination host
  15527.       but gives the (unique) hostname instead,  this  is  called  an  absolute
  15528.       address.
  15529.  
  15530.  
  15531.               In  the  original  UUCP  environment,  the  prevalent  form  was
  15532.       path!host!user, where path described a sequence of hosts the message had
  15533.       to  travel  before  reaching  the  destination  host.  This construct is
  15534.       called the bang path notation, because an exclamation  mark  is  loosely
  15535.       called  a  ``bang''.   Today,  many UUCP-based networks have adopted RFC
  15536.       822, and will understand this type of address.
  15537.  
  15538.  
  15539.             Now, these two types of addressing don't mix too well.  Assume  an
  15540.       address  of hostA!user@hostB. It is not clear whether the `@' sign takes
  15541.       precedence over the path, or vice versa: do we have to send the  message
  15542.       to  hostB,  which mails it to hostA!user, or should it be sent to hostA,
  15543.       which fowards it to user@hostB?
  15544.  
  15545.  
  15546.            Addresses that mix different types of address operators are  called
  15547.       hybrid  addresses.  Most  notorious  is the above example. It is usually
  15548.       resolved by giving the `@' sign precedence over the path. In  the  above
  15549.       example, this means sending the message to hostB first.
  15550.  
  15551.  
  15552.       
  15553.  
  15554.       2. This is because disk space is usually allocated in blocks
  15555.          of 1024 Bytes.  So even a message of at  most  400  Bytes
  15556.          will eat a full KB.
  15557.  
  15558.  
  15559.  
  15560.  
  15561.  
  15562.  
  15563.  
  15564.                                  - 236 -
  15565.  
  15566.  
  15567.  
  15568.              However,  there  is a way to specify routes in RFC 822-conformant
  15569.       ways: <@hostA,@hostB:user@hostC> denotes the address of user  on  hostC,
  15570.       where  hostC  is  to be reached through hostA and hostB (in that order).
  15571.       This type of address is freqeuently called a route-addr address.
  15572.  
  15573.  
  15574.             Then, there is the `%'  address  operator:  user%hostB@hostA  will
  15575.       first be sent to hostA, which expands the rightmost (in this case, only)
  15576.       percent sign to an `@' sign. The address  is  now  user@hostB,  and  the
  15577.       mailer  will  happily forward your message to hostB which delivers it to
  15578.       user.  This type of address  is  sometimes  referred  to  as  ``Ye  Olde
  15579.       ARPANET  Kludge'',  and  its use is discouraged. Nevertheless, many mail
  15580.       transport agents generate this type of address.
  15581.  
  15582.  
  15583.            Other networks have still different means  of  addressing.  DECnet-
  15584.       based  networks,  for  example,  use two colons as an address separator,
  15585.       yielding an address of host::user.(3) Lastly, the X.400 standard uses an
  15586.       entirely  different  scheme,  by  describing  a  recipient  by  a set of
  15587.       attribute-value pairs, like country and organization.
  15588.  
  15589.  
  15590.            On FidoNet, each user is identified by  a  code  like  2:320/204.9,
  15591.       consisting  of  four  numbers  denoting zone (2 is for Europe), net (320
  15592.       being Paris and Banlieue), node (the local hub), and point (the individ-
  15593.       ual  user's  PC).  Fidonet addresses can be mapped to RFC 822; the above
  15594.       would  be  written  as  Thomas.Quinot@p9.f204.n320.z2.fidonet.org.   Now
  15595.       didn't I say domain names are easy to remember?
  15596.  
  15597.  
  15598.            There  are  some  implications  to  using  these different types of
  15599.       addressing which will be described throughout the following sections. In
  15600.       a  RFC  822 environment, however, you will rarely use anything else than
  15601.       absolute addresses like user@host.domain.
  15602.  
  15603.  
  15604.  
  15605.  
  15606.  
  15607.       14.4  How does Mail Routing Work?
  15608.  
  15609.  
  15610.  
  15611.  
  15612.            The process of directing a  message  to  the  recipient's  host  is
  15613.       called  routing.  Apart from finding a path from the sending site to the
  15614.       destination, it involves error checking as well as speed and cost  opti-
  15615.       mization.
  15616.  
  15617.  
  15618.  
  15619.       
  15620.  
  15621.       3. When trying to reach a DECnet address  from  an  RFC  822
  15622.          environment,  you may use "host::user"@relay, where relay
  15623.          is the name of a known Internet-DECnet relay.
  15624.  
  15625.  
  15626.  
  15627.  
  15628.  
  15629.  
  15630.  
  15631.                                  - 237 -
  15632.  
  15633.  
  15634.  
  15635.            There is a big difference between the way a UUCP site handles rout-
  15636.       ing, and the way an Internet site does. On the Internet, the main job of
  15637.       directing  data  to  the  recipient  host  (once  it is known by it's IP
  15638.       address) is done by the IP networking layer, while in the UUCP zone, the
  15639.       route  has to be supplied by the user, or generated by the mail transfer
  15640.       agent.
  15641.  
  15642.  
  15643.       14.4.1  Mail Routing on the Internet
  15644.  
  15645.  
  15646.  
  15647.  
  15648.            On the Internet,  it  depends  entirely  on  the  destination  host
  15649.       whether any specific mail routing is performed at all. The default is to
  15650.       deliver the message to the destination host directly by looking  up  its
  15651.       IP address, and leave the actual routing of the data to the IP transport
  15652.       layer.
  15653.  
  15654.  
  15655.             Most sites will usually want to  direct  all  inbound  mail  to  a
  15656.       highly  available mail server that is capable of handling all this traf-
  15657.       fic, and have it distribute this mail locally. To announce this service,
  15658.       the  site  publishes a so-called MX record for their local domain in the
  15659.       DNS database.  MX stands for Mail Exchanger and  basically  states  that
  15660.       the  server  host is willing to act as a mail forwarder for all machines
  15661.       in this domain.  MX records may also be used to handle traffic for hosts
  15662.       that  are  not connected to the Internet themselves, like UUCP networks,
  15663.       or company networks with hosts carrying confidential information.
  15664.  
  15665.  
  15666.            MX records also have a preference associated with them.  This is  a
  15667.       positive  integer.  If  several  mail exchangers exist for one host, the
  15668.       mail transport agent will try to transfer the message to  the  exchanger
  15669.       with  the  lowest preference value, and only if this fails will it try a
  15670.       host with a higher value. If the local host is itself a  mail  exchanger
  15671.       for  the  destination  address,  it  must not forward messages to any MX
  15672.       hosts with a higher preference than its own;  this  is  a  safe  way  of
  15673.       avoiding mail loops.
  15674.  
  15675.  
  15676.            Suppose  that an organization, say Foobar Inc., want all their mail
  15677.       handled by their machine called mailhub.  They  will  then  have  an  MX
  15678.       record like this in the DNS database:
  15679.  
  15680.  
  15681.  
  15682.            foobar.com        IN   MX      5    mailhub.foobar.com
  15683.  
  15684.  
  15685.  
  15686.  
  15687.            This announces mailhub.foobar.com as  a  mail  exchanger  for  foo-
  15688.       bar.com  with  a  preference value of 5. A host that wishes to deliver a
  15689.  
  15690.  
  15691.  
  15692.  
  15693.  
  15694.  
  15695.  
  15696.  
  15697.                                  - 238 -
  15698.  
  15699.  
  15700.  
  15701.       message to joe@greenhouse.foobar.com will check DNS for foobar.com,  and
  15702.       finds  the MX record pointing at mailhub.  If there's no MX with a pref-
  15703.       erence smaller than 5, the message will be delivered to  mailhub,  which
  15704.       then dispatches it to greenhouse.
  15705.  
  15706.  
  15707.            The above is really only a sketch of how MX records work.  For more
  15708.       information on the mail routing on the Internet,  please  refer  to  RFC
  15709.       974.
  15710.  
  15711.  
  15712.       14.4.2  Mail Routing in the UUCP World
  15713.  
  15714.  
  15715.  
  15716.  
  15717.            Mail  routing on UUCP networks is much more complicated than on the
  15718.       Internet, because the transport software does not  perform  any  routing
  15719.       itself.   In  earlier  times,  all  mail  had to be addressed using bang
  15720.       paths.  Bang paths specified a list of hosts through  which  to  forward
  15721.       the  message, separated by exclamation marks, and followed by the user's
  15722.       name.  To address a letter to Janet User on a machine named  moria,  you
  15723.       would  have used the path eek!swim!moria!janet. Whis would have sent the
  15724.       mail from your host to eek, from there on to swim and finally to  moria.
  15725.  
  15726.  
  15727.            The  obvious  drawback of this technique is that it requires you to
  15728.       remember much about the network topology, fast links, etc.   Much  worse
  15729.       than  that, changes in the network topology --- like links being deleted
  15730.       or hosts being removed --- may cause messages to fail simply because you
  15731.       weren't  aware of the change. And finally, in case you move to a differ-
  15732.       ent place, you will most likely have to update all these routes.
  15733.  
  15734.  
  15735.             One thing, however, that made the use of source routing  necessary
  15736.       was  the presence of ambiguous hostnames: For instance, assume there are
  15737.       two sites named moria, one in the U.S., and one in  France.  Which  site
  15738.       now does moria!janet refer to? This can be made clear by specifying what
  15739.       path to reach moria through.
  15740.  
  15741.  
  15742.             The first step in disambiguating hostnames was the founding of The
  15743.       UUCP Mapping Project. It is located at Rutgers University, and registers
  15744.       all official UUCP hostnames, along with information on their UUCP neigh-
  15745.       bors  and  their  geographic  location,  making sure no hostname is used
  15746.       twice. The information gathered by the Mapping Project is  published  as
  15747.       the Usenet Maps, which are distributed regularly  through  Usenet.(4)  A
  15748.       typical  system  entry in a Map (after removing the comments) looks like
  15749.       this.
  15750.  
  15751.       
  15752.  
  15753.       4. Maps  for  sites registered with The UUCP Mapping Project
  15754.          are distributed  through  the  newsgroup  comp.mail.maps;
  15755.          other  organizations  may publish separate maps for their
  15756.          network.
  15757.  
  15758.  
  15759.  
  15760.  
  15761.  
  15762.  
  15763.  
  15764.                                  - 239 -
  15765.  
  15766.  
  15767.  
  15768.            moria
  15769.                    bert(DAILY/2),
  15770.                    swim(WEEKLY)
  15771.  
  15772.  
  15773.  
  15774.  
  15775.            This entry says that moria has a link to bert, which it calls twice
  15776.       a day, and swim, which it calls weekly. We will come  back  to  the  Map
  15777.       file format in more detail below.
  15778.  
  15779.  
  15780.              Using  the connectivity information provided in the maps, you can
  15781.       automatically generate the full paths from your host to any  destination
  15782.       site.  This information is usually stored in the paths file, also called
  15783.       pathalias database sometimes.  Assume the Maps state that you can  reach
  15784.       bert  through ernie, then a pathalias entry for moria generated from the
  15785.       Map snippet above may look like this:
  15786.  
  15787.  
  15788.  
  15789.            moria           ernie!bert!moria!%s
  15790.  
  15791.  
  15792.  
  15793.  
  15794.            If you now give a destination address of janet@moria.uucp, your MTA
  15795.       will  pick  the route shown above, and send the message to ernie with an
  15796.       envelope address of bert!moria!janet.
  15797.  
  15798.  
  15799.             Building a paths file from the full Usenet maps is however  not  a
  15800.       very  good idea. The information provided in them is usually rather dis-
  15801.       torted, and occasionally out of date.  Therefore, only a number of major
  15802.       hosts  use the complete UUCP world maps to build their paths file.  Most
  15803.       sites only maintain routing information for sites in their neighborhood,
  15804.       and  send  any  mail  to  sites  they don't find in their databases to a
  15805.       smarter host with more complete  routing  information.  This  scheme  is
  15806.       called smart-host routing.  Hosts that have only one UUCP mail link (so-
  15807.       called leaf sites) don't do any routing of their own; they rely entirely
  15808.       on their smart-host.
  15809.  
  15810.  
  15811.       14.4.3  Mixing UUCP and RFC 822
  15812.  
  15813.         The best cure against the problems of mail routing in UUCP networks so
  15814.       far is the adoption of the domain  name  system  in  UUCP  networks.  Of
  15815.       course, you can't query a name server over UUCP. Nevertheless, many UUCP
  15816.       sites have formed small domains that  coordinate  their  routing  inter-
  15817.       nally. In the Maps, these domains announce one or two host as their mail
  15818.       gateways, so that there doesn't have to be a map entry for each host  in
  15819.       the  domain. The gateways handle all mail that flows into and out of the
  15820.       domain. The routing scheme inside the domain is completely invisible  to
  15821.       the outside world.
  15822.  
  15823.  
  15824.  
  15825.  
  15826.  
  15827.  
  15828.  
  15829.  
  15830.                                  - 240 -
  15831.  
  15832.  
  15833.  
  15834.            This  works  very well with the smart-host routing scheme described
  15835.       above.  Global routing information is maintained by the  gateways  only;
  15836.       minor  hosts  within  a  domain  will  get along with only a small hand-
  15837.       written paths file that lists the routes inside their  domain,  and  the
  15838.       route to the mail hub.  Even the mail gateways do not have to have rout-
  15839.       ing information for every single UUCP host in the world anymore.  Beside
  15840.       the  complete  routing  information for the domain they serve, they only
  15841.       need to have routes to  entire  domains  in  their  databases  now.  For
  15842.       instance,  the pathalias entry shown below will route all mail for sites
  15843.       in the sub.org domain to smurf:
  15844.  
  15845.  
  15846.  
  15847.             .sub.org        swim!smurf!%s
  15848.  
  15849.  
  15850.  
  15851.  
  15852.            Any mail addressed to claire@jones.sub.org will  be  sent  to  swim
  15853.       with an envelope address of smurf!jones!claire.
  15854.  
  15855.  
  15856.            The  hierarchical organization of the domain name space allows mail
  15857.       servers to mix  more  specific  routes  with  less  specific  ones.  For
  15858.       instance,  a system in France may have specific routes for subdomains of
  15859.       fr, but route any mail for hosts in the us domain toward some system  in
  15860.       the  U.S.   In  this  way,  domain-based  routing  (as this technique is
  15861.       called) greatly reduces the size of  routing  datbases  as  well  as  te
  15862.       administrative overhead needed.
  15863.  
  15864.  
  15865.            The  main benefit of using domain names in a UUCP environment, how-
  15866.       ever, is that compliance with RFC 822 permits  easy  gatewaying  between
  15867.       UUCP  networks and the Internet.  Many UUCP domains nowadays have a link
  15868.       with an Internet gateway that acts as their  smart-host.   Sending  mes-
  15869.       sages  across  the  Internet  is faster, and routing information is much
  15870.       more reliable because Internet hosts can use DNS instead of  the  Usenet
  15871.       Maps.
  15872.  
  15873.  
  15874.            In order to be reachable from the Internet, UUCP-based domains usu-
  15875.       ally have their Internet gateway announce an  MX  record  for  them  (MX
  15876.       records  were  described above). For instance, assume that moria belongs
  15877.       to the orcnet.org domain.  gcc2.groucho.edu acts as their Internet gate-
  15878.       way.  moria would therefore use gcc2 as its smart-host, so that all mail
  15879.       for foreign domains is delivered across  the  Internet.   On  the  other
  15880.       hand,  gcc2  would announce an MX record for orcnet.org, and deliver all
  15881.       incoming mail for orcnet sites to moria.
  15882.  
  15883.  
  15884.            The only remaining problem is  that  the  UUCP  transport  programs
  15885.       can't  deal  with  fully  qualified domain names.  Most UUCP suites were
  15886.       designed to cope with site names of up to eight  characters,  some  even
  15887.       less,  and  using non-alphanumeric characters such as dots is completely
  15888.  
  15889.  
  15890.  
  15891.  
  15892.  
  15893.  
  15894.  
  15895.  
  15896.                                  - 241 -
  15897.  
  15898.  
  15899.  
  15900.       out of the question for most.
  15901.  
  15902.  
  15903.            Therefore, some mapping between RFC 822 names and UUCP hostnames is
  15904.       needed.   The  way  this  mapping  is done is completely implementation-
  15905.       dependent. One common way of mapping FQDNs to UUCP names is to  use  the
  15906.       pathalias file for this:
  15907.  
  15908.  
  15909.  
  15910.            moria.orcnet.org  ernie!bert!moria!%s
  15911.  
  15912.  
  15913.  
  15914.  
  15915.            This  will produce a pure UUCP-style bang path from an address that
  15916.       specifies a fully qualified domain name. Some mailers provide a  special
  15917.       files for this; sendmail, for instance, uses the uucpxtable for this.
  15918.  
  15919.  
  15920.            The  reverse  transformation  (colloquially called domainizing)  is
  15921.       sometimes required when sending mail from a UUCP network to  the  Inter-
  15922.       net.  As long as the mail sender uses the fully qualified domain name in
  15923.       the destination address, this problem can be avoided by not removing the
  15924.       domain name from the envelope address when forwarding the message to the
  15925.       smart-host. However, there are still some UUCP sites that are  not  part
  15926.       of  any  domain.   They  are usually domainized by appending the pseudo-
  15927.       domain uucp.
  15928.  
  15929.  
  15930.  
  15931.  
  15932.  
  15933.       14.5  Pathalias and Map File Format
  15934.  
  15935.  
  15936.  
  15937.  
  15938.            The pathalias database provides the  main  routing  information  in
  15939.       UUCP-based networks. A typical entry looks like this (site name and path
  15940.       are separated by TABs):
  15941.  
  15942.  
  15943.  
  15944.            moria.orcnet.org  ernie!bert!moria!%s
  15945.            moria             ernie!bert!moria!%s
  15946.  
  15947.  
  15948.  
  15949.  
  15950.            This  makes  any  message to moria be delivered via ernie and bert.
  15951.       Both moria's fully qualified name and its UUCP name have to be given  if
  15952.       the  mailer  does  not  have  a  separate  way to map between these name
  15953.       spaces.
  15954.  
  15955.  
  15956.  
  15957.  
  15958.  
  15959.  
  15960.  
  15961.  
  15962.                                  - 242 -
  15963.  
  15964.  
  15965.  
  15966.             If you want to direct all messages to hosts inside some domain  to
  15967.       its  mail  relay, you may also specify a path in the pathalias database,
  15968.       giving the domain name as target, preceded by a dot. For example, if all
  15969.       hosts  in  the  sub.org may be reached through swim!smurf, the pathalias
  15970.       entry might look like this:
  15971.  
  15972.  
  15973.  
  15974.            \&.sub.org        swim!smurf!%s
  15975.  
  15976.  
  15977.  
  15978.  
  15979.            Writing a pathalias file is acceptable only when you are running  a
  15980.       site  that  does not have to do much routing.  If you have to do routing
  15981.       for a large number of hosts, a better way is to use the  pathalias  com-
  15982.       mand  to  create  the  file from map files.  Maps can be maintained much
  15983.       easier, because you may simply add or remove a  system  by  editing  the
  15984.       system's  map entry, and re-create the map file.  Although the maps pub-
  15985.       lished by the Usenet Mapping Project aren't used for routing  very  much
  15986.       anymore,  smaller UUCP networks may provide routing information in their
  15987.       own set of maps.
  15988.  
  15989.  
  15990.             A map file mainly consists of a list of sites, listing  the  sites
  15991.       each  system  polls  or  is polled by.  The system name begins in column
  15992.       one, and is followed by a comma-separated list of links. The list may be
  15993.       continued across newlines if the next line begins with a tab.  Each link
  15994.       consists of the name of the site, followed by a cost given in  brackets.
  15995.       The  cost  is  an arithmetic expression, made up of numbers and symbolic
  15996.       costs. Lines beginning with a hash sign are ignored.
  15997.  
  15998.  
  15999.            As an example, consider moria, which polls swim.twobirds.com  twice
  16000.       a  day,  and  bert.sesame.com  once per week. Moreover, the link to bert
  16001.       only uses a slow 2400bps modem.  moria's  would  publish  the  following
  16002.       maps entry:
  16003.  
  16004.  
  16005.  
  16006.            moria.orcnet.org
  16007.                    bert.sesame.com(DAILY/2),
  16008.                    swim.twobirds.com(WEEKLY+LOW)
  16009.  
  16010.            moria.orcnet.org = moria
  16011.  
  16012.  
  16013.  
  16014.  
  16015.            The  last  line would make it known under its UUCP name, too.  Note
  16016.       that it must be DAILY/2, because calling twice a day actually halves the
  16017.       cost for this link.
  16018.  
  16019.  
  16020.  
  16021.  
  16022.  
  16023.  
  16024.  
  16025.  
  16026.  
  16027.  
  16028.                                  - 243 -
  16029.  
  16030.  
  16031.  
  16032.            Using  the  information  from  such map files, pathalias is able to
  16033.       calculate optimal routes to any destination site  listed  in  the  paths
  16034.       file,  and produce a pathalias database from this which can then be used
  16035.       for routing to these sites.
  16036.  
  16037.  
  16038.             pathalias provides a couple of  other  features  like  site-hiding
  16039.       (i.e.  making sites accessible only through a gateway) etc. See the man-
  16040.       ual page for pathalias for details, as well as a complete list  of  link
  16041.       costs.
  16042.  
  16043.  
  16044.            Comments  in  the map file generally contain additional information
  16045.       on the sites described in it. There is a rigid format in which to  spec-
  16046.       ify  this,  so  that it can be retrieved from the maps.  For instance, a
  16047.       program called uuwho uses a database created from the map files to  dis-
  16048.       play this information in a nicely formatted way.
  16049.  
  16050.  
  16051.            When  you  register your site with an organization that distributes
  16052.       map files to its members, you generally have to  fill  out  such  a  map
  16053.       entry.
  16054.  
  16055.  
  16056.            Below is a sample map entry (in fact, it's the one for my site):
  16057.  
  16058.  
  16059.  
  16060.            #N      monad, monad.swb.de, monad.swb.sub.org
  16061.            #S      AT 486DX50; Linux 0.99
  16062.            #O      private
  16063.            #C      Olaf Kirch
  16064.            #E      okir@monad.swb.de
  16065.            #P      Kattreinstr. 38, D-64295 Darmstadt, FRG
  16066.            #L      49 52 03 N / 08 38 40 E
  16067.            #U      brewhq
  16068.            #W      okir@monad.swb.de (Olaf Kirch); Sun Jul 25 16:59:32 MET DST 1993
  16069.            #
  16070.            monad   brewhq(DAILY/2)
  16071.            # Domains
  16072.            monad = monad.swb.de
  16073.            monad = monad.swb.sub.org
  16074.  
  16075.  
  16076.  
  16077.  
  16078.            The white space after the first two characters is a TAB.  The mean-
  16079.       ing of most of the fields is pretty obvious; you will receive a detailed
  16080.       description from whichever domain you register with.  The L field is the
  16081.       most fun to find out: it  gives  your  geographical  position  in  lati-
  16082.       tude/longitude  and  is  used  to draw the postscript maps that show all
  16083.       sites for each country, as well as world-wide.(5)
  16084.  
  16085.  
  16086.  
  16087.  
  16088.  
  16089.  
  16090.  
  16091.  
  16092.  
  16093.  
  16094.                                  - 244 -
  16095.  
  16096.  
  16097.  
  16098.       14.6  Configuring elm
  16099.  
  16100.  
  16101.  
  16102.  
  16103.            elm  stands  for ``electronic mail'' and is one of the more reason-
  16104.       ably named Un*x tools. It provides a full-screen interface with  a  good
  16105.       help  feature.  We  won't discuss here how to use elm, but only dwell on
  16106.       its configuration options.
  16107.  
  16108.  
  16109.            Theoretically, you can run elm unconfigured, and  everything  works
  16110.       well --- if you are lucky. But there are a few options that must be set,
  16111.       although only required on occasions.
  16112.  
  16113.  
  16114.            When it starts, elm reads a set of configuration variables from the
  16115.       elm.rc  file  in  /usr/lib/elm.  Then,  it will attempt to read the file
  16116.       .elm/elmrc in your home directory. You don't  usually  write  this  file
  16117.       yourself.  It  is  created  when  you choose ``save options'' from elm's
  16118.       options menu.
  16119.  
  16120.  
  16121.            The set of options for the private elmrc file is also available  in
  16122.       the  global  elm.rc file. Most settings in your private elmrc file over-
  16123.       ride those of the global file.
  16124.  
  16125.  
  16126.       14.6.1  Global elm Options
  16127.  
  16128.       In the global elm.rc file, you must set the options that pertain to your
  16129.       host's  name.  For  example, at the Virtual Brewery, the file for vlager
  16130.       would contain the following:
  16131.  
  16132.  
  16133.  
  16134.            #
  16135.            # The local hostname
  16136.            hostname = vlager
  16137.            #
  16138.            # Domain name
  16139.            hostdomain = .vbrew.com
  16140.            #
  16141.            # Fully qualified domain name
  16142.            hostfullname = vlager.vbrew.com
  16143.  
  16144.  
  16145.  
  16146.  
  16147.            These  options  set elm's idea of the local hostname. Although this
  16148.       information is rarely used, you should set these  options  nevertheless.
  16149.  
  16150.       
  16151.  
  16152.       5. They are posted regularly in news.lists.ps-maps.  Beware.
  16153.          They're HUGE.
  16154.  
  16155.  
  16156.  
  16157.  
  16158.  
  16159.  
  16160.  
  16161.                                  - 245 -
  16162.  
  16163.  
  16164.  
  16165.       Note  that these options only take effect when giving them in the global
  16166.       configuration file; when found in  your  private  elmrc,  they  will  be
  16167.       ignored.
  16168.  
  16169.  
  16170.       14.6.2  National Character Sets
  16171.  
  16172.  
  16173.  
  16174.  
  16175.            Recently,  there  have been proposals to amend the RFC 822 standard
  16176.       to support various types of messages, such as plain text,  binary  data,
  16177.       Postscript  files,  etc.  The  set  of standards and RFCs covering these
  16178.       aspects are commonly referred to as MIME, or Multipurpose Internet  Mail
  16179.       Extensions.   Among other things, this also lets the recipient know if a
  16180.       character set other than standard ASCII has been used when  writing  the
  16181.       message,  for  example using French accents, or German umlauts.  This is
  16182.       supported by elm to some extent.
  16183.  
  16184.  
  16185.            The character set used by Linux internally to represent  characters
  16186.       is  usually referred to as ISO-8859-1, which is the name of the standard
  16187.       it conforms to. It is also known as Latin-1.  Any message using  charac-
  16188.       ters  from  this  character  set  should  have the following line in its
  16189.       header:
  16190.  
  16191.  
  16192.            Content-Type: text/plain; charset=iso-8859-1
  16193.  
  16194.  
  16195.  
  16196.  
  16197.            The receiving system should recognize this field and take appropri-
  16198.       ate  measures  when  displaying  the message. The default for text/plain
  16199.       messages is a charset value of us-ascii.
  16200.  
  16201.  
  16202.            To be able to display  messages  with  character  sets  other  than
  16203.       ASCII, elm must know how to print these characters. By default, when elm
  16204.       receives a message with a charset field other than us-ascii (or  a  con-
  16205.       tent  type  other than text/plain, for that matter), it tries to display
  16206.       the message using a command called metamail. Messages that require meta-
  16207.       mail  to  be displayed are shown with an `M' in the very first column in
  16208.       the overview screen.
  16209.  
  16210.  
  16211.             Since Linux' native character set is ISO-8859-1, calling  metamail
  16212.       is not necessary to display messages using this character set. If elm is
  16213.       told that the display understands ISO-8859-1, it will not  use  metamail
  16214.       but  will display the message directly instead. This can be done by set-
  16215.       ting the following option in the global elm.rc:
  16216.  
  16217.  
  16218.  
  16219.  
  16220.  
  16221.  
  16222.  
  16223.  
  16224.  
  16225.  
  16226.  
  16227.                                  - 246 -
  16228.  
  16229.  
  16230.  
  16231.            displaycharset = iso-8859-1
  16232.  
  16233.  
  16234.  
  16235.  
  16236.            Note that you should set this options even when you are never going
  16237.       to  send  or receive any messages that actually contain characters other
  16238.       than ASCII. This is because people who do  send  such  messages  usually
  16239.       configure  their  mailer  to put the proper Content-Type: field into the
  16240.       mail header by default, whether or not they are sending ASCII-only  mes-
  16241.       sages.
  16242.  
  16243.  
  16244.            However,  setting this option in elm.rc is not enough.  The problem
  16245.       is that when displaying the message with its builtin pager, elm calls  a
  16246.       library function for each character to determine whether it is printable
  16247.       or not. By default, this function will only recognize  ASCII  characters
  16248.       as printable, and display all other characters as ``^?''.  You may over-
  16249.       come this by setting the environment variable  LC CTYPE  to  ISO-8859-1,
  16250.       which  tells the library to accept Latin-1 characters as printable. Sup-
  16251.       port for this and other features is available since libc-4.5.8.
  16252.  
  16253.  
  16254.            When  sending  messages  that  contain  special   characters   from
  16255.       ISO-8859-1, you should make sure to set two more variables in the elm.rc
  16256.       file:
  16257.  
  16258.  
  16259.            charset = iso-8859-1
  16260.            textencoding = 8bit
  16261.  
  16262.  
  16263.  
  16264.  
  16265.            This makes elm report the character set as ISO-8859-1 in  the  mail
  16266.       header, and send it as an 8 bit value (the default is to strip all char-
  16267.       acters to 7 bit).
  16268.  
  16269.  
  16270.            Of course, any of these options can also  be  set  in  the  private
  16271.       elmrc file instead of the global one.
  16272.  
  16273.  
  16274.  
  16275.  
  16276.  
  16277.  
  16278.  
  16279.  
  16280.  
  16281.  
  16282.  
  16283.  
  16284.  
  16285.  
  16286.  
  16287.  
  16288.  
  16289.  
  16290.  
  16291.  
  16292.  
  16293.                                  - 247 -
  16294.  
  16295.  
  16296.  
  16297.       15.  Getting smail Up and Running
  16298.  
  16299.  
  16300.  
  16301.  
  16302.            This  chapter  will  give  you  a  quick introduction to setting up
  16303.       smail, and an overview of the functionality it provides. Although  smail
  16304.       is  largely  compatible with sendmail in its behaviour, their configura-
  16305.       tion files are completely different.
  16306.  
  16307.  
  16308.             The main configuration file  is  the  /usr/lib/smail/config.   You
  16309.       always  have  to edit this file to reflect values specific to your site.
  16310.       If you are only a UUCP leaf site, you will have relatively  little  else
  16311.       to  do,  ever.  Other files that configure routing and transport options
  16312.       may also be used; they will be dealt with briefly, too.
  16313.  
  16314.  
  16315.             By default, smail processes and delivers all incoming mail immedi-
  16316.       ately.  If  you have relatively high traffic, you may instead have smail
  16317.       collect all messages in the so-called queue, and process it  at  regular
  16318.       intervals only.
  16319.  
  16320.  
  16321.              When  handling  mail within a TCP/IP network, smail is frequently
  16322.       run in daemon mode: at system boot time, it is  invoked  from  rc.inet2,
  16323.       and  puts  itself in the background where it waits for incoming TCP con-
  16324.       nections on the SMTP port (usually port 25).  This  is  very  beneficial
  16325.       whenever  you  expect  to  have a significant amount of traffic, because
  16326.       smail isn't started up separately for  every  incoming  connection.  The
  16327.       alternative  would  be  to  have inetd manage the SMTP port, and have it
  16328.       spawn smail whenever there is a connection on this port.
  16329.  
  16330.  
  16331.             smail has a lot a flags that control it behavior; describing  them
  16332.       in  detail here wouldn't make help you much. Fortunately, smail supports
  16333.       a number of standard modes of operation that are enabled when you invoke
  16334.       it  by  a  special  command  name, like rmail, or smtpd.  Usually, these
  16335.       aliases are symbolic links to the smail binary itself. We will encounter
  16336.       most of them when discussing the various features of smail.
  16337.  
  16338.  
  16339.            There  are  two  links  to  smail you should have under all circum-
  16340.       stances; namely /usr/bin/rmail and /usr/sbin/sendmail.(1) When you  com-
  16341.       pose  and  send  a  mail message with a user agent like elm, the message
  16342.       will be piped into rmail for delivery, with the recipient list given  to
  16343.       it  on  the command line. The same happens with mail coming in via UUCP.
  16344.       Some versions of elm,  however,  invoke  /usr/sbin/sendmail  instead  of
  16345.       rmail,  so  you  need  both  of them.  For example, if you keep smail in
  16346.       /usr/local/bin, type the following at the shell prompt:
  16347.  
  16348.       
  16349.  
  16350.       1. This is the new standard location of  sendmail  according
  16351.          to   the  Linux  File  System  Standard.  Another  common
  16352.          location is /usr/lib.
  16353.  
  16354.  
  16355.  
  16356.  
  16357.  
  16358.  
  16359.  
  16360.                                  - 248 -
  16361.  
  16362.  
  16363.  
  16364.            # ln -s /usr/local/bin/smail /usr/bin/rmail
  16365.            # ln -s /usr/local/bin/smail /usr/sbin/sendmail
  16366.  
  16367.  
  16368.  
  16369.  
  16370.            If  you  want to dig further into the details of configuring smail,
  16371.       please refer to the manual pages smail(1) and  smail(5).   If  it  isn't
  16372.       included  in  your  favorite Linux distribution, you can get it from the
  16373.       source to smail.
  16374.  
  16375.  
  16376.       15.1  UUCP Setup
  16377.  
  16378.  
  16379.  
  16380.  
  16381.            To use smail in a UUCP-only environment, the basic installation  is
  16382.       rather simple. First, you must make sure you have the two symbolic links
  16383.       to rmail and sendmail mentioned above. If you  expect  to  receive  SMTP
  16384.       batches from other sites, you also have to make rsmtp a link to smail.
  16385.  
  16386.  
  16387.              In Vince Skahan's smail distribution, you will find a sample con-
  16388.       figuration  file.   It   is   named   config.sample   and   resides   in
  16389.       /usr/lib/smail.  You  have  to  copy it to config and edit it to reflect
  16390.       values specific to your site.
  16391.  
  16392.  
  16393.            Assume your site is named swim.twobirds.com, and is  registered  in
  16394.       the UUCP maps as swim. Your smarthost is ulysses.  Then your config file
  16395.       should look like this:
  16396.  
  16397.  
  16398.  
  16399.            #
  16400.            # Our domain names
  16401.            visible domain=two.birds:uucp
  16402.            #
  16403.            # Our name on outgoing mails
  16404.            visible name=swim.twobirds.com
  16405.            #
  16406.            # Use this as uucp-name as well
  16407.            uucp name=swim.twobirds.com
  16408.            #
  16409.            # Our smarthost
  16410.            smart host=ulysses
  16411.  
  16412.  
  16413.  
  16414.  
  16415.              The  first  statement  tells  smail  about  the domains your site
  16416.       belongs to.  Insert their names here, separated by colons. If your  site
  16417.       name  is  registered  in  the UUCP maps, you should also add uucp.  When
  16418.  
  16419.  
  16420.  
  16421.  
  16422.  
  16423.  
  16424.  
  16425.  
  16426.                                  - 249 -
  16427.  
  16428.  
  16429.  
  16430.       being handed a mail message, smail determines your host's name using the
  16431.       hostname(2) system call, and checks the recipient's address against this
  16432.       hostname, tacking on all names from this list in turn.  If  the  address
  16433.       matches  any  of these names, or the unqualified hostname, the recipient
  16434.       is considered local, and smail attempts to deliver the message to a user
  16435.       or  alias  on  the  local  host.  Otherwise, the recipient is considered
  16436.       remote, and delivery to the destination host is attempted.
  16437.  
  16438.  
  16439.            visible name should contain a single, fully qualified  domain  name
  16440.       of  your  site that you want to use on outgoing mails. This name is used
  16441.       when generating the sender's address on all  outgoing  mail.   You  must
  16442.       make  sure to use a name that smail recognizes as referring to the local
  16443.       host (i.e. the hostname with one of the  domains  listed  in  the  visi-
  16444.       ble domain  attribute). Otherwise, replies to your mails will bounce off
  16445.       your site.
  16446.  
  16447.  
  16448.             The last statement sets  the  path  used  for  smart-host  routing
  16449.       (described  in section 14.4). With this sample setup, smail will forward
  16450.       any mail for remote addresses to the smart host. The path  specified  in
  16451.       the  smart path  attribute  will  be  used as a route to the smart host.
  16452.       Since messages will be delivered via UUCP, the attribute must specify  a
  16453.       system  known to your UUCP software. Please refer to chapter 13. on mak-
  16454.       ing a site known to UUCP.
  16455.  
  16456.  
  16457.            There's one option used in the above file that we haven't explained
  16458.       yet;  this  is  uucp name.  The  reason  to  use  the option is this: By
  16459.       default, smail uses the value returned by hostname(2) for  UUCP-specific
  16460.       things  such  as the return path given in the From  header line. If your
  16461.       hostname is not registered with the UUCP  mapping  project,  you  should
  16462.       tell  smail to use your fully qualified domain name instead.(2) This can
  16463.       be done by adding the uucp name option to the config file.
  16464.  
  16465.  
  16466.            There is another file in /usr/lib/smail, called paths.sample. It is
  16467.       an  example  of what a paths file might look like. However, you will not
  16468.       need one unless you have mail links to more than one site.  If  you  do,
  16469.       however,  you  will have to write one yourself, or generate one from the
  16470.       Usenet maps. The paths file will be described later in this chapter.
  16471.  
  16472.  
  16473.  
  16474.  
  16475.  
  16476.  
  16477.  
  16478.  
  16479.       
  16480.  
  16481.       2. The reason is this: Assume your hostname is monad, but is
  16482.          not registered in the maps. However, there is a  site  in
  16483.          the  maps called monad, so every mail to monad!root, even
  16484.          sent from a direct UUCP neighbor of yours, will  wind  up
  16485.          on the other monad. This is a nuisance for everybody.
  16486.  
  16487.  
  16488.  
  16489.  
  16490.  
  16491.  
  16492.  
  16493.                                  - 250 -
  16494.  
  16495.  
  16496.  
  16497.       15.2  Setup for a LAN
  16498.  
  16499.  
  16500.  
  16501.  
  16502.            If you are running a site with two or more  hosts  connected  by  a
  16503.       LAN,  you will have to designate one host that handles your UUCP connec-
  16504.       tion with the outside world. Between the hosts on  your  LAN,  you  will
  16505.       most probably want to exchange mail with SMTP over TCP/IP.  Assume we're
  16506.       back at the Virtual Brewery again, and vstout is  set  up  as  the  UUCP
  16507.       gateway.
  16508.  
  16509.  
  16510.              In a networked environment, it is best to keep all user mailboxes
  16511.       on a single file system, which is NFS-mounted on all other  hosts.  This
  16512.       allows  users  to  move  from machine to machine, without having to move
  16513.       their mail around (or even worse, check some three or four machines  for
  16514.       newly-arrived  mail  each  morning).  Therefore,  you  also want to make
  16515.       sender addresses independent from the machine the mail was  written  on.
  16516.       It is common practice to use the domain name all by itself in the sender
  16517.       address, instead of a hostname.  Janet User, for example, would  specify
  16518.       janet@vbrew.com  instead of janet@vale.vbrew.com.  We will explain below
  16519.       how to make the server recognize the domain name as  a  valid  name  for
  16520.       your site.
  16521.  
  16522.  
  16523.              A  different way of keeping all mailboxes on a central host is to
  16524.       use POP or IMAP.  POP stands for Post Office  Protocol  and  lets  users
  16525.       access their mailboxes over a simple TCP/IP conection.  IMAP, the Inter-
  16526.       active Mail Access Protocol, is similar to POP, but more  general.  Both
  16527.       clients  and servers for IMAP and POP have been ported to Linux, and are
  16528.       available from sunsite.unc.edu below /pub/Linux/system/Network.
  16529.  
  16530.  
  16531.       15.2.1  Writing the Configuration Files
  16532.  
  16533.  
  16534.  
  16535.  
  16536.            The configuration for the  Brewery  works  as  follows:  all  hosts
  16537.       except  the  mail  server  vstout  itself route all outgoing mail to the
  16538.       server, using smart host routing. vstout itself sends all outgoing  mail
  16539.       to  the real smart host that routes all of the Brewery's mail; this host
  16540.       is called moria.
  16541.  
  16542.  
  16543.            The standard config file for all hosts other than vstout looks like
  16544.       this:
  16545.  
  16546.  
  16547.  
  16548.  
  16549.  
  16550.  
  16551.  
  16552.  
  16553.  
  16554.  
  16555.  
  16556.  
  16557.  
  16558.  
  16559.                                  - 251 -
  16560.  
  16561.  
  16562.  
  16563.            #
  16564.            # Our domain:
  16565.            visible domain=vbrew.com
  16566.            #
  16567.            # What we name ourselves
  16568.            visible name=vbrew.com
  16569.            #
  16570.            # Smart-host routing: via SMTP to vstout
  16571.            smart path=vstout
  16572.            smart transport=smtp
  16573.  
  16574.  
  16575.  
  16576.  
  16577.            This is very similar to what we used for a UUCP-only site. The main
  16578.       difference is that the transport used to send mail to the smart host is,
  16579.       of course, SMTP. The visible domain attribute makes smail use the domain
  16580.       name instead of the local hostname on all outgoing mail.
  16581.  
  16582.  
  16583.             On the UUCP mail gateway vstout, the config file  looks  a  little
  16584.       different:
  16585.  
  16586.  
  16587.  
  16588.            #
  16589.            # Our hostnames:
  16590.            hostnames=vbrew.com:vstout.vbrew.com:vstout
  16591.            #
  16592.            # What we name ourselves
  16593.            visible name=vbrew.com
  16594.            #
  16595.            # in the uucp world, we're known as vbrew.com
  16596.            uucp name=vbrew.com
  16597.            #
  16598.            # Smart transport: via uucp to moria
  16599.            smart path=moria
  16600.            smart transport=uux
  16601.            #
  16602.            # we're authoritative for our domain
  16603.            auth domains=vbrew.com
  16604.  
  16605.  
  16606.  
  16607.  
  16608.            This config file uses a different scheme to  tell  smail  what  the
  16609.       local  host  is called.  Instead of giving it a list of domains and let-
  16610.       ting it find the hostname with  a  system  call,  it  specifies  a  list
  16611.       explicitly.   The  above  list contains both the fully qualified and the
  16612.       unqualified hostname, and the domain name  all  by  itself.  This  makes
  16613.       smail recognize janet@vbrew.com as a local address, and deliver the mes-
  16614.       sage to janet.
  16615.  
  16616.  
  16617.  
  16618.  
  16619.  
  16620.  
  16621.  
  16622.  
  16623.  
  16624.  
  16625.                                  - 252 -
  16626.  
  16627.  
  16628.  
  16629.            The auth domains variable names the domains  for  which  vstout  is
  16630.       considered  to  be  authoritative.  That  is, if smail receives any mail
  16631.       addressed to host.vbrew.com where host does not name an  existing  local
  16632.       machine,  it  rejects the message and returns it to the sender.  If this
  16633.       entry isn't present, any such message will be sent  to  the  smart-host,
  16634.       who  will  return  it  to  vstout,  and  so on until it is discarded for
  16635.       exceeding the maximum hop count.
  16636.  
  16637.  
  16638.       15.2.2  Running smail
  16639.  
  16640.  
  16641.  
  16642.  
  16643.            First, you have to decide whether to run smail as a  separate  dae-
  16644.       mon, or whether to have inetd manage the SMTP port and invoke smail only
  16645.       whenever an SMTP connection is requested from some client. Usually,  you
  16646.       will  prefer daemon operation on the mail server, because this loads the
  16647.       machine far less than spawning smail over and over again for each single
  16648.       connection. As the mail server also delivers most incoming mail directly
  16649.       to the users, you will choose inetd operation on most other hosts.
  16650.  
  16651.  
  16652.             Whatever mode of operation you choose for  each  individual  host,
  16653.       you have to make sure you have the following entry in your /etc/services
  16654.       file:
  16655.  
  16656.  
  16657.  
  16658.            smtp            25/tcp          # Simple Mail Transfer Protocol
  16659.  
  16660.  
  16661.  
  16662.  
  16663.            This  defines  the  TCP  port number that smail should use for SMTP
  16664.       conversations. 25 is the standard defined by the Assigned Numbers RFC.
  16665.  
  16666.  
  16667.            When run in daemon mode, smail will put itself in  the  background,
  16668.       and  wait  for a connection to occur on the SMTP port. When a connection
  16669.       occurs, it forks and conducts an SMTP conversation with  the  peer  pro-
  16670.       cess.   The  smail  daemon  is  usually  started by invoking it from the
  16671.       rc.inet2 script using the following command:
  16672.  
  16673.  
  16674.            /usr/local/bin/smail -bd -q15m
  16675.  
  16676.  
  16677.  
  16678.  
  16679.            The -bd flag turns on daemon mode, and -q15m makes it process what-
  16680.       ever messages have accumulated in the message queue every 15 minutes.
  16681.  
  16682.  
  16683.  
  16684.  
  16685.  
  16686.  
  16687.  
  16688.  
  16689.  
  16690.  
  16691.                                  - 253 -
  16692.  
  16693.  
  16694.  
  16695.             If you want to use inetd instead, your /etc/inetd.conf file should
  16696.       contain a line like this:
  16697.  
  16698.  
  16699.  
  16700.            smtp    stream  tcp nowait  root  /usr/sbin/smtpd smtpd
  16701.  
  16702.  
  16703.  
  16704.  
  16705.            smtpd  should be a symbolic link to the smail binary.  Remember you
  16706.       have to make inetd re-read inetd.conf by sending it a HUP  signal  after
  16707.       making these changes.
  16708.  
  16709.  
  16710.            Daemon mode and inetd mode are mutually exclusive. If you run smail
  16711.       in deamon mode, you  should  make  sure  to  comment  out  any  line  in
  16712.       inetd.conf  for the smtp service. Equivalently, when having inetd manage
  16713.       smail, make sure that rc.inet2 does not start the smail daemon.
  16714.  
  16715.  
  16716.  
  16717.  
  16718.  
  16719.       15.3  If You Don't Get Through...
  16720.  
  16721.  
  16722.  
  16723.  
  16724.            If something goes wrong with your installation, there are a  number
  16725.       of features that may help you to find what's at the root of the problem.
  16726.       The first place to check  are  smail's  log  files.  They  are  kept  in
  16727.       /var/spool/smail/log,  and are named logfile and paniclog, respectively.
  16728.       The former lists all transactions, while the latter is  only  for  error
  16729.       messages related to configuration errors and the like.
  16730.  
  16731.  
  16732.            A typical entry in logfile looks like this:
  16733.  
  16734.  
  16735.  
  16736.            04/24/94 07:12:04: [m0puwU8-00023UB] received
  16737.            |            from: root
  16738.            |         program: sendmail
  16739.            |            size: 1468 bytes
  16740.            04/24/94 07:12:04: [m0puwU8-00023UB] delivered
  16741.            |             via: vstout.vbrew.com
  16742.            |              to: root@vstout.vbrew.com
  16743.            |         orig-to: root@vstout.vbrew.com
  16744.            |          router: smart host
  16745.            |       transport: smtp
  16746.  
  16747.  
  16748.  
  16749.  
  16750.  
  16751.  
  16752.  
  16753.  
  16754.  
  16755.  
  16756.  
  16757.                                  - 254 -
  16758.  
  16759.  
  16760.  
  16761.            This shows that a message from root  to  root@vstout.vbrew.com  has
  16762.       been properly delivered to host vstout over SMTP.
  16763.  
  16764.  
  16765.            Messages  smail  could  not deliver generate a similar entry in the
  16766.       log file, but with an error message instead of the delivered part:
  16767.  
  16768.  
  16769.  
  16770.            04/24/94 07:12:04: [m0puwU8-00023UB] received
  16771.            |            from: root
  16772.            |         program: sendmail
  16773.            |            size: 1468 bytes
  16774.            04/24/94 07:12:04: [m0puwU8-00023UB] root@vstout.vbrew.com ... deferred
  16775.             (ERR 148) transport smtp: connect: Connection refused
  16776.  
  16777.  
  16778.  
  16779.  
  16780.            The  above error is typical for a situation in which smail properly
  16781.       recognizes that the message should be delivered to vstout  but  was  not
  16782.       able  to  connect  to  the  SMTP service on vstout. If this happens, you
  16783.       either have a configuration problem, or TCP support is missing from your
  16784.       smail binaries.
  16785.  
  16786.  
  16787.              This  problem  is  not as uncommon as one might think. There have
  16788.       been precompiled smail binaries around, even  in  some  Linux  distribu-
  16789.       tions,  without  support  for TCP/IP networking. If this is the case for
  16790.       you, you have to compile smail yourself. Having installed smail, you can
  16791.       check if it has TCP networking support by telnetting to the SMTP port on
  16792.       your machine. A successful connect to the SMTP  server  is  shown  below
  16793.       (your input is marked like this):
  16794.  
  16795.  
  16796.            $ telnet localhost smtp
  16797.            Trying 127.0.0.1...
  16798.            Connected to localhost.
  16799.            Escape character is '^]'.
  16800.            220 monad.swb.de Smail3.1.28.1 #6 ready at Sun, 23 Jan 94
  16801.            19:26 MET
  16802.            QUIT
  16803.            221 monad.swb.de closing connection
  16804.  
  16805.  
  16806.  
  16807.  
  16808.            If this test doesn't produce the SMTP  banner  (the  line  starting
  16809.       with  the  220  code), first make sure that your configuration is really
  16810.       correct before  you  go  through  compiling  smail  yourself,  which  is
  16811.       described below.
  16812.  
  16813.  
  16814.            If you encounter a problem with smail that you are unable to locate
  16815.  
  16816.  
  16817.  
  16818.  
  16819.  
  16820.  
  16821.  
  16822.  
  16823.                                  - 255 -
  16824.  
  16825.  
  16826.  
  16827.       from the error message smail generates, you may want to turn  on  debug-
  16828.       ging messages. You can do this using the -d flag, optionally followed by
  16829.       a number specifying the level of verbosity (you may not have  any  space
  16830.       between  the  flag and the numerical argument).  smail will then print a
  16831.       report of its operation to the screen, which may  give  you  more  hints
  16832.       about what is going wrong.
  16833.  
  16834.  
  16835.            [Don't know,...Maybe people don't find this funny:] If nothing else
  16836.       helps, you may want to invoke smail in Rogue  mode  by  giving  the  -bR
  16837.       option on the command line. The manpage says on this option: ``Enter the
  16838.       hostile domain of giant mail messages, and RFC standard scrolls. Attempt
  16839.       to  make  it  down to protocol level 26 and back.'' Although this option
  16840.       won't  solve  your  problems,  it  may  provide  you  some  comfort  and
  16841.       consolation.(3)
  16842.  
  16843.  
  16844.       15.3.1  Compiling smail
  16845.  
  16846.  
  16847.  
  16848.  
  16849.            If you know for sure that smail is lacking TCP network support, you
  16850.       have to get the source. It is probably included in your distribution, if
  16851.       you got it via CD-ROM, otherwise you may get it from the net via FTP.(4)
  16852.  
  16853.  
  16854.            When compiling smail, you had best start with the set of configura-
  16855.       tion files from Vince Skahan's newspak distribution. To compile  in  the
  16856.       TCP networking driver, you have to set the DRIVER CONFIGURATION macro in
  16857.       the conf/EDITME file to either bsd-network or arpa-network.  The  former
  16858.       is  suitable  for  LAN  installations,  but  the Internet requires arpa-
  16859.       network.  The difference between these two is that the latter has a spe-
  16860.       cial driver for BIND service that is able to recognize MX records, which
  16861.       the former doesn't.
  16862.  
  16863.  
  16864.       15.4  Mail Delivery Modes
  16865.  
  16866.  
  16867.  
  16868.  
  16869.            As noted above, smail is able to deliver messages  immediately,  or
  16870.       queue them for later processing.  If you choose to queue messages, smail
  16871.       will  store  away   all   mail   in   the   messages   directory   below
  16872.       /var/spool/smail.  It  will  not  process  them until explicitly told so
  16873.       (this is also called ``running the queue'').
  16874.  
  16875.  
  16876.       
  16877.  
  16878.       3. Don't use this if you're in a really bad mood.
  16879.       4. If you bought this  with  a  Linux  distribution  from  a
  16880.          vendor,  you  are  entitled  to  the  source code ``for a
  16881.          nominal shipping charge'', according to  smail's  copying
  16882.          conditions.
  16883.  
  16884.  
  16885.  
  16886.  
  16887.  
  16888.  
  16889.  
  16890.                                  - 256 -
  16891.  
  16892.  
  16893.  
  16894.            You can select one of three delivery modes by  setting  the  deliv-
  16895.       ery mode  attribute  in  the  config file to either of foreground, back-
  16896.       ground, or queued. These select delivery in  the  foreground  (immediate
  16897.       processing  of incoming messages), in the background, (message is deliv-
  16898.       ered by a child of the receiving process, with the parent process  exit-
  16899.       ing immediately after forking), and queued. Incoming mail will always be
  16900.       queued regardless of this option if the boolean variable  queue only  is
  16901.       set in the config file.
  16902.  
  16903.  
  16904.            If  you  turn  on  queuing,  you  have  to make sure the queues are
  16905.       checked regularly; probably every 10 or 15 minutes.  If you run smail in
  16906.       daemon  mode,  you  have  to add the option -q10m on the command line to
  16907.       process the queue every 10 minutes.  Alternatively, you can invoke  runq
  16908.       from cron at these intervals. runq should be a link to smail.
  16909.  
  16910.  
  16911.              You can display the current mail queue by invoking smail with the
  16912.       -bp option. Equivalently, you can make mailq a link to smail, and invoke
  16913.       mailq:
  16914.  
  16915.  
  16916.  
  16917.            $ mailq -v
  16918.            m0pvB1r-00023UB From: root  (in /var/spool/smail/input)
  16919.                            Date: Sun, 24 Apr 94 07:12 MET DST
  16920.                            Args: -oem -oMP sendmail root@vstout.vbrew.com
  16921.            Log of transactions:
  16922.             Xdefer: <root@vstout.vbrew.com> reason: (ERR 148) transport smtp:
  16923.             connect: Connection refused
  16924.  
  16925.  
  16926.  
  16927.  
  16928.            This  shows  a  single  message  sitting  in the message queue. The
  16929.       transaction log (which is only  displayed  if  you  give  mailq  the  -v
  16930.       option) may give an additional reason why it is still waiting for deliv-
  16931.       ery.  If no attempt has been made yet to deliver the message, no  trans-
  16932.       action log will be displayed.
  16933.  
  16934.  
  16935.              Even when you don't use queuing, smail will occasionally put mes-
  16936.       sages into the queue when it finds immediate delivery fails for a  tran-
  16937.       sient reason. For SMTP connections, this may be an unreachable host; but
  16938.       messages may also be deferred when the file system is found to be  full.
  16939.       You  should  therefore put in a queue run every hour or so (using runq),
  16940.       else any deferred message will stick around the queue forever.
  16941.  
  16942.  
  16943.  
  16944.  
  16945.  
  16946.  
  16947.  
  16948.  
  16949.  
  16950.  
  16951.  
  16952.  
  16953.  
  16954.  
  16955.  
  16956.                                  - 257 -
  16957.  
  16958.  
  16959.  
  16960.       15.5  Miscellaneous config Options
  16961.  
  16962.  
  16963.  
  16964.  
  16965.            There are quite a number of options you may set in the config file,
  16966.       which, although useful, are not essential to running smail, and which we
  16967.       will not discuss here. Instead, we will only  mention  a  few  that  you
  16968.       might find a reason to use:
  16969.  
  16970.  
  16971.  
  16972.  
  16973.       error copy postmaster   If  this boolean variable is set, any error will
  16974.                 generate a message to the postmaster.  Usually, this  is  only
  16975.                 done  for  errors that are due to a faulty configuration.  The
  16976.                 variable can be turned on by putting it in  the  config  file,
  16977.                 preceded by a plus (+).
  16978.  
  16979.  
  16980.       max hop count   If the hop count for a message (i.e. the number of hosts
  16981.                 already traversed) equals or exceeds this number, attempts  at
  16982.                 remote delivery will result in an error message being returned
  16983.                 to the sender. This is used to prevent messages  from  looping
  16984.                 forever.  The  hop count is generally computed from the number
  16985.                 of Received: fields in the mail header, but may  also  be  set
  16986.                 manually using the -h option on the command line.
  16987.  
  16988.  
  16989.                      This variable defaults to 20.
  16990.  
  16991.  
  16992.       postmaster   The  postmaster's address. If the address Postmaster cannot
  16993.                 be resolved to a valid local address, then this is used as the
  16994.                 last resort. The default is root.
  16995.  
  16996.  
  16997.  
  16998.  
  16999.  
  17000.       15.6  Message Routing and Delivery
  17001.  
  17002.  
  17003.  
  17004.  
  17005.            smail  splits  up  mail  delivery  into  three different tasks, the
  17006.       router, director, and transport module.
  17007.  
  17008.  
  17009.            The router module resolves all  remote  addresses,  determining  to
  17010.       which  host the message should be sent to next, and which transport must
  17011.       be used. Depending on the nature of the link, different transports  such
  17012.       as UUCP or SMTP may be used.
  17013.  
  17014.  
  17015.  
  17016.  
  17017.  
  17018.  
  17019.  
  17020.  
  17021.  
  17022.                                  - 258 -
  17023.  
  17024.  
  17025.  
  17026.            Local  addresses  are given to the director task which resolves any
  17027.       forwarding or aliasing. For example, the address might be an alias or  a
  17028.       mailing  list,  or  the  user  might want to forward her mail to another
  17029.       address.  If the resulting address is remote, it is handed to the router
  17030.       module  for additional routing, otherwise it is assigned a transport for
  17031.       local delivery. By far the most common case will be delivery to a  mail-
  17032.       box,  but messages may also be piped into a command, or appended to some
  17033.       arbitrary file.
  17034.  
  17035.  
  17036.            The transport module, finally, is responsible for  whatever  method
  17037.       of  delivery  has  been  chosen. It tries to deliver the message, and in
  17038.       case of failure either generates a bounce message, or defers  it  for  a
  17039.       later retry.
  17040.  
  17041.  
  17042.             With smail, you have much freedom in configuring these tasks.  For
  17043.       each of them, a number of drivers are  available,  from  which  you  can
  17044.       choose  those you need. You describe them to smail in a couple of files,
  17045.       namely routers, directors, and transports, located in /usr/lib/smail. If
  17046.       these files do not exist, reasonable defaults are assumed that should be
  17047.       suitable for many sites that either use SMTP or UUCP for  transport.  If
  17048.       you  want  to  change smail's routing policy, or modify a transport, you
  17049.       should  get the sample files from the smail source distribution,(5) copy
  17050.       the sample files to /usr/lib/smail, and modify them  according  to  your
  17051.       needs. Sample configuration files are also given in Appendix 20.3.
  17052.  
  17053.  
  17054.       15.7  Routing Messages
  17055.  
  17056.  
  17057.  
  17058.  
  17059.            When  given a message, smail first checks if the destination is the
  17060.       local host, or a remote site.  If the target host address is one of  the
  17061.       local  hostnames  configured  in  config,  the  message is handed to the
  17062.       director module. Otherwise, smail hands the  destination  address  to  a
  17063.       number of router drivers to find out which host to forward a message to.
  17064.       They can be described in the routers file; if this file does not  exist,
  17065.       a set of default routers are used.
  17066.  
  17067.  
  17068.            The  destination host is passed to all routers in turn, and the one
  17069.       finding  the  most  specific  route  is  selected.  Consider  a  message
  17070.       addressed  to  joe@foo.bar.com.  Then,  one  router might know a default
  17071.       route for all hosts in the bar.com domain, while another one has  infor-
  17072.       mation  for foo.bar.com itself. Since the latter is more specific, it is
  17073.       chosen over the former. If there are two routers that provide  a  ``best
  17074.       match'', the one coming first in the routers file is chosen.
  17075.  
  17076.  
  17077.       
  17078.  
  17079.       5. The  default  configuration  files  can   be   found   in
  17080.          samples/generic below the source directory.
  17081.  
  17082.  
  17083.  
  17084.  
  17085.  
  17086.  
  17087.  
  17088.                                  - 259 -
  17089.  
  17090.  
  17091.  
  17092.            This  router  now  specifies the transport to be used, for instance
  17093.       UUCP, and generates a new destination address. The new address is passed
  17094.       to  the transport along with the host to forward the message to.  In the
  17095.       above example, smail might find out that foo.bar.com is  to  be  reached
  17096.       via  UUCP using the path ernie!bert.  It will then generate a new target
  17097.       of bert!foo.bar.com!user, and have the UUCP transport use  this  as  the
  17098.       envelope address to be passed to ernie.
  17099.  
  17100.  
  17101.            When using the default setup, the following routers are available:
  17102.  
  17103.  
  17104.  
  17105.  
  17106.               + If  the  destination  host  address  can be resolved using the
  17107.                 gethostbyname(3) or gethostbyaddr(3) library call, the message
  17108.                 will  be  delivered  via  SMTP.  The  only exception is if the
  17109.                 address is found to refer to the local host, it is  handed  to
  17110.                 the director module, too.
  17111.  
  17112.  
  17113.                      smail also recognizes IP addresses written as dotted quad
  17114.                 as a legal hostname, as long as they can be resolved through a
  17115.                 gethostbyaddr(3)  call.   For  example,  scrooge@[149.76.12.4]
  17116.                 would be a valid although  highly  unusual  mail  address  for
  17117.                 scrooge on quark.physics.groucho.edu.
  17118.  
  17119.  
  17120.                      If your machine is on the Internet, these routers are not
  17121.                 what you are looking for,  because  they  do  not  support  MX
  17122.                 records. See below for what to do in this case.
  17123.  
  17124.  
  17125.               +   If  /usr/lib/smail/paths,  the  pathalias  database, exists,
  17126.                 smail will try to look up the target host (minus any  trailing
  17127.                 .uucp)  in  this  file.   Mail  to  an address matched by this
  17128.                 router will be delivered using UUCP, using the path  found  in
  17129.                 the database.
  17130.  
  17131.  
  17132.               +   The host address (minus any trailing .uucp) will be compared
  17133.                 to the output of the uuname command to  check  if  the  target
  17134.                 host is in fact a UUCP neighbor. If this is the case, the mes-
  17135.                 sage will be delivered using the UUCP transport.
  17136.  
  17137.  
  17138.               + If the address has not  been  matched  by  any  of  the  above
  17139.                 routers,  it  will be delivered to the smart host. The path to
  17140.                 the smart host as well as the transport to be used are set  in
  17141.                 the config file.
  17142.  
  17143.  
  17144.  
  17145.  
  17146.  
  17147.  
  17148.  
  17149.  
  17150.  
  17151.  
  17152.  
  17153.  
  17154.                                  - 260 -
  17155.  
  17156.  
  17157.  
  17158.            These  defaults  work  for  many simple setups, but fail if routing
  17159.       requirements get a little more complicated. If you are faced with any of
  17160.       the  problems discussed below, you will have to install your own routers
  17161.       file to override the defaults. A sample routers  file  you  might  start
  17162.       with is given in appendix 20.3.  Some Linux distributions also come with
  17163.       a set of configuration files that are tailored to work around these dif-
  17164.       ficulties.
  17165.  
  17166.  
  17167.              Probably  the worst problems arise when your host lives in a dual
  17168.       universe with both dialup IP and UUCP links. You will  then  have  host-
  17169.       names in your hosts file that you only talk occasionally to through your
  17170.       SLIP link, so smail will attempt to deliver any mail for these hosts via
  17171.       SMTP.  This  is usually not what you want, because even if the SLIP link
  17172.       is activated regularly, SMTP is much slower than sending the  mail  over
  17173.       UUCP. With the default setup, there's no way escaping smail.
  17174.  
  17175.  
  17176.            You  can  avoid  this  problem by having smail check the paths file
  17177.       before querying the resolver, and put all hosts you want to  force  UUCP
  17178.       delivery  to into the paths file. If you don't want to send any messages
  17179.       over SMTP ever, you can also  comment  out  the  resolver-based  routers
  17180.       altogether.
  17181.  
  17182.  
  17183.             Another problem is that the default setup doesn't provide for true
  17184.       Internet mail routing, because the resolver-based router does not evalu-
  17185.       ate  MX  records. To enable full support for Internet mail routing, com-
  17186.       ment out this router, and uncomment the  one  that  used  BIND  instead.
  17187.       There  are, however, smail binaries included in some Linux distributions
  17188.       that don't have BIND support compiled in. If you enable BIND, but get  a
  17189.       message in the paniclog file saying ``router inet hosts: driver bind not
  17190.       found'', then you have to get the sources and recompile smail (see  sec-
  17191.       tion 15.2 above).
  17192.  
  17193.  
  17194.            Finally,  it is not generally a good idea to use the uuname driver.
  17195.       For one, it will generate a configuration error when you don't have UUCP
  17196.       installed,  because  no uuname command will be found. The second is when
  17197.       you have more sites listed in your UUCP Systems file than  you  actually
  17198.       have mail links with. These may be sites you only exchange news with, or
  17199.       sites you occasionally download files from via anonymous UUCP, but  have
  17200.       no traffic with otherwise.
  17201.  
  17202.  
  17203.            To work around the first problem, you can substitute a shell script
  17204.       for uuname which does a simple exit 0.  The more  general  solution  is,
  17205.       however, to edit the routers file and remove this driver altogether.
  17206.  
  17207.  
  17208.       15.7.1  The paths database
  17209.  
  17210.  
  17211.  
  17212.  
  17213.  
  17214.  
  17215.  
  17216.  
  17217.  
  17218.  
  17219.  
  17220.                                  - 261 -
  17221.  
  17222.  
  17223.  
  17224.            smail  expects  to  find  the  pathalias database in the paths file
  17225.       below /usr/lib/smail. This file is optional, so if  you  don't  want  to
  17226.       perform  any  pathalias routing at all, simply remove any existing paths
  17227.       file.
  17228.  
  17229.  
  17230.            paths must be a sorted ASCII file that contains entries  which  map
  17231.       destination  site  names  to  UUCP bang paths. The file has to be sorted
  17232.       because smail uses a binary search for looking up a site.  Comments  are
  17233.       not  allowed  in this file, and the site name must be separated from the
  17234.       path using a TAB.  Pathalias databases are discussed in somewhat greater
  17235.       detail in chapter 14..
  17236.  
  17237.  
  17238.            If  you generate this file by hand, you should make sure to include
  17239.       all legal names for a site. For example, if a site is known  by  both  a
  17240.       plain  UUCP  name  and a fully qualified domain name, you have to add an
  17241.       entry for each of them.  The file can be sorted by piping it through the
  17242.       sort(1) command.
  17243.  
  17244.  
  17245.            If  your  site  is  only  a  leaf site, however, then no paths file
  17246.       should be necessary at all: just set up the  smart  host  attributes  in
  17247.       your config file, and leave all routing to your mail feed.
  17248.  
  17249.  
  17250.  
  17251.  
  17252.  
  17253.       15.8  Delivering Messages to Local Addresses
  17254.  
  17255.  
  17256.  
  17257.  
  17258.            Most  commonly,  a  local  address  is just a user's login name, in
  17259.       which   case   the   message    is    delivered    to    her    mailbox,
  17260.       /var/spool/mail/user.   Other  cases  include  aliases  and mailing list
  17261.       names, and mail forwarding by  the  user.  In  these  cases,  the  local
  17262.       address expands to a new list of addresses, which may be either local or
  17263.       remote.
  17264.  
  17265.  
  17266.            Apart from these ``normal'' addresses, smail can handle other types
  17267.       of  local  message  destinations,  like  file  names, and pipe commands.
  17268.       These are not addresses in their own right, so you can't send  mail  to,
  17269.       say,  /etc/passwd@vbrew.com; they are only valid if they have been taken
  17270.       from forwarding or alias files.
  17271.  
  17272.  
  17273.             A file name is anything that begins with a slash (/)  or  a  tilde
  17274.       (~).   The  latter  refers to the user's home directory, and is possible
  17275.       only if the filename was taken from a  .forward  file  or  a  forwarding
  17276.       entry  in  the  mailbox  (see  below).  When delivering to a file, smail
  17277.       appends the messages to the file, creating it if necessary.
  17278.  
  17279.  
  17280.  
  17281.  
  17282.  
  17283.  
  17284.  
  17285.  
  17286.                                  - 262 -
  17287.  
  17288.  
  17289.  
  17290.             A pipe command may be any Un*x command preceded by the pipe symbol
  17291.       (|).  This  causes smail to hand the command to the shell along with its
  17292.       arguments, but without the leading `|'.  The message itself  is  fed  to
  17293.       this command on standard input.
  17294.  
  17295.  
  17296.            For  example,  to  gate  a mailing list into a local newsgroup, you
  17297.       might use a shell script named gateit, and set up a  local  alias  which
  17298.       delivers  all  messages  from  this  mailing  list  to  the script using
  17299.       "|gateit".
  17300.  
  17301.  
  17302.            If the invocation contains white space, it has to  be  enclosed  in
  17303.       double quotes. Due to the security issues involved, care is taken not to
  17304.       execute the command if the address has been obtained in a somewhat dubi-
  17305.       ous way (for example, if the alias file from which the address was taken
  17306.       was writable by everyone).
  17307.  
  17308.  
  17309.       15.8.1  Local Users
  17310.  
  17311.  
  17312.  
  17313.  
  17314.            The most common case for a local address  is  to  denote  a  user's
  17315.       mailbox.  This mailbox is located in /var/spool/mail and has the name of
  17316.       the user.  It is owned by her, with a group of mail, and has  mode  660.
  17317.       If it does not exist, it is created by smail.
  17318.  
  17319.  
  17320.            Note  that although /var/spool/mail is currently the standard place
  17321.       to put the mailbox files, some mail software may  have  different  paths
  17322.       compiled  in,  for example /usr/spool/mail. If delivery to users on your
  17323.       machine fails consistently, you should try if it helps to  make  this  a
  17324.       symbolic link to /var/spool/mail.
  17325.  
  17326.  
  17327.            There  are two addresses smail requires to exist: MAILER-DAEMON and
  17328.       Postmaster. When generating a bounce message for an undeliverable  mail,
  17329.       a carbon copy is sent to the postmaster account for examination (in case
  17330.       this might be due to a configuration  problem).   The  MAILER-DAEMON  is
  17331.       used as the sender's address on the bounce message.
  17332.  
  17333.  
  17334.            If these addresses do not name valid accounts on your system, smail
  17335.       implicitly maps MAILER-DAEMON to  postmaser,  and  postmaster  to  root,
  17336.       respectively.  You should usually override this by aliasing the postmas-
  17337.       ter account to whoever is responsible for maintaining the mail software.
  17338.  
  17339.  
  17340.       15.8.2  Forwarding
  17341.  
  17342.  
  17343.  
  17344.  
  17345.  
  17346.  
  17347.  
  17348.  
  17349.  
  17350.  
  17351.  
  17352.                                  - 263 -
  17353.  
  17354.  
  17355.  
  17356.            A  user may redirect her mail by having it forwarded to an alterna-
  17357.       tive address using one of two methods supported by smail.  One option is
  17358.       to put
  17359.  
  17360.  
  17361.            Forward to recipient,...
  17362.  
  17363.  
  17364.  
  17365.       in the first line of her mailbox file.  This will send all incoming mail
  17366.       to the specified list of recipients. Alternatively, she might  create  a
  17367.       .forward  file in her home directory, which contains the comma-separated
  17368.       list of recipients.  With this variety of forwarding, all lines  of  the
  17369.       file are read and interpreted.
  17370.  
  17371.  
  17372.            Note  that any type of address may be used. Thus, a practical exam-
  17373.       ple of a .forward file for vacations might be
  17374.  
  17375.  
  17376.  
  17377.            janet, "|vacation"
  17378.  
  17379.  
  17380.  
  17381.  
  17382.            The first address delivers the incoming message to janet's  mailbox
  17383.       nevertheless, while the vacation command returns a short notification to
  17384.       the sender.
  17385.  
  17386.  
  17387.       15.8.3  Alias Files
  17388.  
  17389.  
  17390.  
  17391.  
  17392.            smail is able to handle alias files compatible with those known  by
  17393.       Berkeley's sendmail. Entries in the alias file may have the form
  17394.  
  17395.  
  17396.            alias: recipients
  17397.  
  17398.  
  17399.  
  17400.  
  17401.            recipients is a comma-separated list of addresses that will be sub-
  17402.       stituted for the alias. The recipient list may be continued across  new-
  17403.       lines if the next line begins with a TAB.
  17404.  
  17405.  
  17406.            There  is  a  special  feature  that allows smail to handle mailing
  17407.       lists from the alias  file:  if  you  specify  ``:include:filename''  as
  17408.       recipient,  smail  will read the file specified, and substitute its con-
  17409.       tents as a list of recipients.
  17410.  
  17411.  
  17412.  
  17413.  
  17414.  
  17415.  
  17416.  
  17417.  
  17418.                                  - 264 -
  17419.  
  17420.  
  17421.  
  17422.            The main aliases file is /usr/lib/aliases. If you  choose  to  make
  17423.       this  file  world-writable,  smail wil not deliver any messages to shell
  17424.       commands given in this file. A sample file is shown below:
  17425.  
  17426.  
  17427.  
  17428.            # vbrew.com /usr/lib/aliases file
  17429.            hostmaster: janet
  17430.            postmaster: janet
  17431.            usenet: phil
  17432.            # The development mailing list.
  17433.            development: joe, sue, mark, biff
  17434.                    /var/mail/log/development
  17435.            owner-development: joe
  17436.            # Announcements of general interest are mailed to all
  17437.            # of the staff
  17438.            announce: :include: /usr/lib/smail/staff,
  17439.                    /var/mail/log/announce
  17440.            owner-announce: root
  17441.            # gate the foobar mailing list to a local newsgroup
  17442.            ppp-list: "|/usr/local/lib/gateit local.lists.ppp"
  17443.  
  17444.  
  17445.  
  17446.  
  17447.            If an error occurs while delivering to an  address  generated  from
  17448.       the aliases file, smail will attempt to send a copy of the error message
  17449.       to the ``alias owner''. For example, if  delivery  to  biff  fails  when
  17450.       delivering  a  message  to  the  development mailing list, a copy of the
  17451.       error message will be mailed to the sender, as well as to postmaster and
  17452.       owner-development.   If  the owner address does not exist, no additional
  17453.       error message will be generated.
  17454.  
  17455.  
  17456.            When delivering to files or when invoking  programs  given  in  the
  17457.       aliases  file,  smail  will become the nobody user to avoid any security
  17458.       hassles. Especially when delivering to files, this can be  a  real  nui-
  17459.       sance.  In  the  file  given  above, for instance, the log files must be
  17460.       owned and writable by nobody, or delivery to them will fail.
  17461.  
  17462.  
  17463.  
  17464.  
  17465.  
  17466.       15.8.4  Mailing Lists
  17467.  
  17468.  
  17469.  
  17470.  
  17471.            Instead of using the aliases file, mailing lists may also  be  man-
  17472.       aged  by means of files in the /usr/lib/smail/lists directory. A mailing
  17473.       list named nag-bugs is  described  by  the  file  lists/nag-bugs,  which
  17474.       should contain the members' addresses, separated by commas. The list may
  17475.       be given on multiple lines, with comments being  introduced  by  a  hash
  17476.  
  17477.  
  17478.  
  17479.  
  17480.  
  17481.  
  17482.  
  17483.  
  17484.                                  - 265 -
  17485.  
  17486.  
  17487.  
  17488.       sign.
  17489.  
  17490.  
  17491.            For  each  mailing  list,  a  user  (or alias) named owner-listname
  17492.       should exist;  any  errors  occurring  when  resolving  an  address  are
  17493.       reported to this user. This address is also used as the sender's address
  17494.       on all outgoing messages in the Sender: header field.
  17495.  
  17496.  
  17497.  
  17498.  
  17499.  
  17500.       15.9  UUCP-based Transports
  17501.  
  17502.  
  17503.  
  17504.  
  17505.            There are a number of transports compiled into smail  that  utilize
  17506.       the UUCP suite. In a UUCP environment, messages are usually passed on by
  17507.       invoking rmail on the next host, giving it the message on standard input
  17508.       and the envelope address on the command line. On your host, rmail should
  17509.       be a link to the smail command.
  17510.  
  17511.  
  17512.            When handing a message to the UUCP transport,  smail  converts  the
  17513.       target  address  to  a  UUCP  bang  path. For example, user@host will be
  17514.       transformed to host!user. Any occurrence of the `%' address operator  is
  17515.       preserved,  so user%host@gateway will become gateway!user%host. However,
  17516.       smail will never generate such addresses itself.
  17517.  
  17518.  
  17519.             Alternatively, smail can send and receive BSMTP batches via  UUCP.
  17520.       With  BSMTP,  one or more messages are wrapped up in a single batch that
  17521.       contains the commands the local mailer would issue if a real  SMTP  con-
  17522.       nection  had  be  established.   BSMTP  is frequently used in store-and-
  17523.       forward (e.g. UUCP-based) networks  to  save  disk  space.   The  sample
  17524.       transports  file in appendix 20.3 contains a transport dubbed bsmtp that
  17525.       generates partial BSMTP batches in a queue directory. They must be  com-
  17526.       bined  into  the final batches later, using a shell script that adds the
  17527.       appropriate HELO and QUIT command.
  17528.  
  17529.  
  17530.            To enable the bsmtp transport for specific UUCP links you  have  to
  17531.       use so-called method files (please refer to the smail(5) manual page for
  17532.       details).  If you have only one  UUCP  link,  and  use  the  smart  host
  17533.       router,  you  enable sending SMTP batches by setting the smart transport
  17534.       configuration variable to bsmtp instead of uux.
  17535.  
  17536.  
  17537.            To receive SMTP batches over UUCP, you must make sure that you have
  17538.       the  unbatching  command  the  remote  site sends its batches to. If the
  17539.       remote site uses smail, too, you need to make rsmtp a link to smail.  If
  17540.       the  remote  site runs sendmail, you should additionally install a shell
  17541.       script named  /usr/bin/bsmtp  that  does  a  simple  ``exec  rsmtp''  (a
  17542.  
  17543.  
  17544.  
  17545.  
  17546.  
  17547.  
  17548.  
  17549.  
  17550.                                  - 266 -
  17551.  
  17552.  
  17553.  
  17554.       symbolic link won't work).
  17555.  
  17556.  
  17557.  
  17558.  
  17559.  
  17560.       15.10  SMTP-based Transports
  17561.  
  17562.  
  17563.  
  17564.  
  17565.            smail  currently  supports  an SMTP driver to deliver mail over TCP
  17566.       connections.(6) It is capable of delivering a message to any  number  of
  17567.       addresses  on  one  single  host,  with  the hostname being specified as
  17568.       either a fully qualified domain name that can be resolved  by  the  net-
  17569.       working  software,  or in dotted quad notation enclosed in square brack-
  17570.       ets.  Generally, addresses resolved  by  any  of  the  BIND,  gethostby-
  17571.       name(3),  or  gethostbyaddr(3)  router  drivers will be delivered to the
  17572.       SMTP transport.
  17573.  
  17574.  
  17575.            The SMTP driver will attempt to connect to the remote host  immedi-
  17576.       ately through the smtp port as listed in /etc/services.  If it cannot be
  17577.       reached, or the connection times out, delivery will be reattempted at  a
  17578.       later time.
  17579.  
  17580.  
  17581.            Delivery  on  the  Internet requires that routes to the destination
  17582.       host be specified in the route-addr format  described  in  chapter  14.,
  17583.       rather   than   as  a  bang  path.(7)  smail  will  therefore  transform
  17584.       user%host@gateway, where gateway is reached via host1!host2!host3,  into
  17585.       the source-route address <@host2,@host3:user%host@gateway> which will be
  17586.       sent as the message's envelope address to host1.  To enable these trans-
  17587.       formation  (along  with  the built-in BIND driver), you have to edit the
  17588.       entry for the smtp driver in the transports file.  A  sample  transports
  17589.       file is given in Appendix 20.3.
  17590.  
  17591.  
  17592.  
  17593.  
  17594.  
  17595.       15.11  Hostname Qualification
  17596.  
  17597.  
  17598.  
  17599.  
  17600.            Sometimes  it  is  desirable  to  catch unqualified hostnames (i.e.
  17601.  
  17602.       
  17603.  
  17604.       6. The authors call this support ``simple''.  For  a  future
  17605.          version of smail, they advertise a complete backend which
  17606.          will handle this more efficiently.
  17607.       7. However, the use of routes in the Internet is discouraged
  17608.          altogether.  Fully qualified domain names should be  used
  17609.          instead.
  17610.  
  17611.  
  17612.  
  17613.  
  17614.  
  17615.  
  17616.  
  17617.                                  - 267 -
  17618.  
  17619.  
  17620.  
  17621.       those that don't have a domain name) specified in  sender  or  recipient
  17622.       addresses,  for  example when gatewaying between two networks, where one
  17623.       requires fully qualified  domain  names.   On  an  Internet-UUCP  relay,
  17624.       unqualifed  hostnames  should  be  mapped to the uucp domain by default.
  17625.       Other address modifications than these are questionable.
  17626.  
  17627.  
  17628.            The /usr/lib/smail/qualify file tells smail which domain  names  to
  17629.       tack  onto  which  hostnames.  Entries in the qualify file consists of a
  17630.       hostname beginning in column one, followed by domain name.   Lines  con-
  17631.       taining a hash sign as its first non-white character are considered com-
  17632.       ments.  Entries are searched in the order they appear in.
  17633.  
  17634.  
  17635.            If no qualify file exists, no hostname qualification  is  performed
  17636.       at all.
  17637.  
  17638.  
  17639.            A special hostname of * matches any hostnames, thus enabling you to
  17640.       map all hosts not mentioned before into a default domain. It  should  be
  17641.       used only as the last entry.
  17642.  
  17643.  
  17644.            At  the  Virtual  Brewery,  all hosts have been set up to use fully
  17645.       qualified domain names in the sender's addresses. Unqualified  recipient
  17646.       addresses  are  considered  to  be  in the uucp domain, so only a single
  17647.       entry in the qualify file is needed.
  17648.  
  17649.  
  17650.  
  17651.            # /usr/lib/smail/qualify, last changed Feb 12, 1994 by janet
  17652.            #
  17653.            *            uucp
  17654.  
  17655.  
  17656.  
  17657.  
  17658.  
  17659.  
  17660.  
  17661.  
  17662.  
  17663.  
  17664.  
  17665.  
  17666.  
  17667.  
  17668.  
  17669.  
  17670.  
  17671.  
  17672.  
  17673.  
  17674.  
  17675.  
  17676.  
  17677.  
  17678.  
  17679.  
  17680.  
  17681.  
  17682.  
  17683.                                  - 268 -
  17684.  
  17685.  
  17686.  
  17687.       16.  Sendmail+IDA
  17688.  
  17689.  
  17690.  
  17691.  
  17692.       16.1  Introduction to Sendmail+IDA
  17693.  
  17694.       It's  been  said  that you aren't a real Unix system administrator until
  17695.       you've edited a sendmail.cf file.  It's also been said that you're crazy
  17696.       if you've attempted to do so twice:-)
  17697.  
  17698.  
  17699.            Sendmail  is  an incredibly powerful program.  It's also incredibly
  17700.       difficult to learn and understand for most people.   Any  program  whose
  17701.       definitive reference (Sendmail, published by O'Reilly and Associates) is
  17702.       792 pages long quite justifiably scares most people off.
  17703.  
  17704.  
  17705.             Sendmail+IDA is different.  It removes the need to edit the always
  17706.       cryptic  sendmail.cf  file  and  allows  the administrator to define the
  17707.       site-specific routing and addressing  configuration  through  relatively
  17708.       easy  to  understand  support  files  called tables.  Switching to send-
  17709.       mail+IDA can save you many hours of work and stress.
  17710.  
  17711.  
  17712.            Compared to the other major mail transport agents, there is  proba-
  17713.       bly  nothing  that  can't  be done faster and simpler with sendmail+IDA.
  17714.       Typical things that are needed to run a normal  UUCP  or  Internet  site
  17715.       become simple to accomplish.  Configurations that normally are extremely
  17716.       difficult are simple to create and maintain.
  17717.  
  17718.  
  17719.            At this writing, the current  version  of  sendmail5.67b+IDA1.5  is
  17720.       available  via anonymous FTP from vixen.cso.uiuc.edu.  It compiles with-
  17721.       out any patching required under Linux.
  17722.  
  17723.  
  17724.            All the configuration files required to get sendmail+IDA sources to
  17725.       compile, install, and run under Linux are included in newspak-2.2.tar.gz
  17726.       which is available via anonymous FTP on sunsite.unc.edu in the directory
  17727.       /pub/Linux/system/Mail.
  17728.  
  17729.  
  17730.       16.2  Configuration Files --- Overview
  17731.  
  17732.  
  17733.  
  17734.  
  17735.             Traditional sendmail is set up through a system configuration file
  17736.       (typically /etc/sendmail.cf or /usr/lib/sendmail.cf), that is  not  any-
  17737.       thing  close to any language you've seen before. Editing the sendmail.cf
  17738.       file to provide customized behavior can be a humbling experience.
  17739.  
  17740.  
  17741.  
  17742.  
  17743.  
  17744.  
  17745.  
  17746.  
  17747.  
  17748.  
  17749.                                  - 269 -
  17750.  
  17751.  
  17752.  
  17753.             Sendmail+IDA makes such pain essentially a thing of  the  past  by
  17754.       having all configuration options table-driven with rather easy to under-
  17755.       stand syntax.  These options are configured by running m4 (a macro  pro-
  17756.       cessor)  or  dbm  (a  database  processor) on a number of data files via
  17757.       Makefiles supplied with the sources.
  17758.  
  17759.  
  17760.             The sendmail.cf file defines only the default behavior of the sys-
  17761.       tem.   Virtually  all  special customization is done through a number of
  17762.       optional tables rather than by directly editing the sendmail.cf file.  A
  17763.       list of all sendmail tables is given in figure 16.2.
  17764.  
  17765.  
  17766.  
  17767.  
  17768.  
  17769.       16.3  The sendmail.cf File
  17770.  
  17771.  
  17772.  
  17773.  
  17774.            The sendmail.cf file for sendmail+IDA is not edited  directly,  but
  17775.       is  generated from an m4 configuration file provided by the local system
  17776.       administrator. In the following, we will refer to it as sendmail.m4.
  17777.  
  17778.  
  17779.            This file contains a few definitions and otherwise merely points to
  17780.       the  tables where the real work gets done.   In general, it is only nec-
  17781.       essary to specify:
  17782.  
  17783.  
  17784.  
  17785.  
  17786.               + the pathnames and filenames used on the local system.
  17787.  
  17788.               + the name(s) the site is known by for e-mail purposes.
  17789.  
  17790.               + which  default  mailer  (and  perhaps  smart  relay  host)  is
  17791.                 desired.
  17792.  
  17793.  
  17794.  
  17795.            There  are  a  large  variety  of parameters that can be defined to
  17796.       establish the behavior of the local site or to override compiled-in con-
  17797.       figuration  items.   These  configuration  options are identified in the
  17798.       file ida/cf/OPTIONS in the source directory.
  17799.  
  17800.  
  17801.            A sendmail.m4 file for a minimal configuration (UUCP or  SMTP  with
  17802.       all non-local mail being relayed to a directly connected smart-host) can
  17803.       be as short as 10 or 15 lines excluding comments.
  17804.  
  17805.  
  17806.  
  17807.  
  17808.  
  17809.  
  17810.  
  17811.  
  17812.  
  17813.  
  17814.  
  17815.                                  - 270 -
  17816.  
  17817.  
  17818.  
  17819.  
  17820.  
  17821.  
  17822.  
  17823.  
  17824.                 mailertable defines  special  behavior for
  17825.                           remote hosts or domains.
  17826.  
  17827.                 uucpxtable forces UUCP delivery of mail to
  17828.                           hosts that are in DNS format.
  17829.                 pathtable defines   UUCP   bang-paths   to
  17830.                           remote hosts or domains.
  17831.  
  17832.                 uucprelays short-circuits  the   pathalias
  17833.                           path to well-known remote hosts.
  17834.  
  17835.                 genericfrom converts  internal   addresses
  17836.                           into generic ones visible to the
  17837.                           outside world.
  17838.  
  17839.                  xaliases converts    generic    addresses
  17840.                           to/from valid internal ones.
  17841.  
  17842.                 decnetxtable converts RFC-822 addresses to
  17843.                           DECnet-style addresses.
  17844.  
  17845.  
  17846.  
  17847.  
  17848.  
  17849.                    Figure 19.   sendmail Support Files.
  17850.  
  17851.       16.3.1  An Example sendmail.m4 File
  17852.  
  17853.       A sendmail.m4 file for vstout at the Virtual  Brewery  is  shown  below.
  17854.       vstout  uses  SMTP  to talk to all hosts on the Brewery's LAN, and sends
  17855.       all mail for other destinations to moria, its Internet relay  host,  via
  17856.       UUCP.
  17857.  
  17858.  
  17859.  
  17860.  
  17861.  
  17862.       16.3.2  Typically Used sendmail.m4 Parameters
  17863.  
  17864.       A  few  or  the items in the sendmail.m4 file are required all the time;
  17865.       others can be ignored if you can get away with defaults.  The  following
  17866.       sections  describe  each of the items in the example sendmail.m4 file in
  17867.       more detail.
  17868.  
  17869.  
  17870.  
  17871.  
  17872.  
  17873.  
  17874.  
  17875.  
  17876.  
  17877.  
  17878.  
  17879.  
  17880.  
  17881.                                  - 271 -
  17882.  
  17883.  
  17884.  
  17885.  
  17886.  
  17887.            dnl #------------------ SAMPLE SENDMAIL.M4 FILE ------------------
  17888.            dnl # (the string 'dnl' is the m4 equivalent of commenting out a line)
  17889.            dnl # you generally don't want to override LIBDIR from the compiled in paths
  17890.            dnl #define(LIBDIR,/usr/local/lib/mail)dnl    # where all support files go
  17891.            define(LOCAL MAILER DEF, mailers.linux)dnl    # mailer for local delivery
  17892.            define(POSTMASTERBOUNCE)dnl                   # postmaster gets bounces
  17893.            define(PSEUDODOMAINS, BITNET UUCP)dnl         # don't try DNS on these
  17894.            dnl #-------------------------------------------------------------
  17895.            dnl #
  17896.            define(PSEUDONYMS, vstout.vbrew.com  vstout.UUCP vbrew.com)
  17897.            dnl                                           # names we're known by
  17898.            define(DEFAULT HOST, vstout.vbrew.com)dnl     # our primary 'name' for mail
  17899.            define(UUCPNAME, vstout)dnl                   # our uucp name
  17900.            dnl #
  17901.            dnl #-------------------------------------------------------------
  17902.            dnl #
  17903.            define(UUCPNODES, |uuname|sort|uniq)dnl       # our uucp neighbors
  17904.            define(BANGIMPLIESUUCP)dnl                    # make certain that uucp
  17905.            define(BANGONLYUUCP)dnl                       #  mail is treated correctly
  17906.            define(RELAY HOST, moria)dnl                  # our smart relay host
  17907.            define(RELAY MAILER, UUCP-A)dnl               # we reach moria via uucp
  17908.            dnl #
  17909.            dnl #--------------------------------------------------------------------
  17910.            dnl #
  17911.            dnl # the various dbm lookup tables
  17912.            dnl #
  17913.            define(ALIASES, LIBDIR/aliases)dnl            # system aliases
  17914.            define(DOMAINTABLE, LIBDIR/domaintable)dnl    # domainize hosts
  17915.            define(PATHTABLE, LIBDIR/pathtable)dnl        # paths database
  17916.            define(GENERICFROM, LIBDIR/generics)dnl       # generic from addresses
  17917.            define(MAILERTABLE, LIBDIR/mailertable)dnl    # mailers per host or domain
  17918.            define(UUCPXTABLE, LIBDIR/uucpxtable)dnl      # paths to hosts we feed
  17919.            define(UUCPRELAYS, LIBDIR/uucprelays)dnl      # short-circuit paths
  17920.            dnl #
  17921.            dnl #--------------------------------------------------------------------
  17922.            dnl #
  17923.            dnl # include the 'real' code that makes it all work
  17924.            dnl # (provided with the source code)
  17925.            dnl #
  17926.            include(Sendmail.mc)dnl                         # REQUIRED ENTRY !!!
  17927.            dnl #
  17928.            dnl #------------ END OF SAMPLE SENDMAIL.M4 FILE -------
  17929.  
  17930.  
  17931.  
  17932.             Figure 20.   A sample sendmail.m4 file for vstout.
  17933.  
  17934.  
  17935.       16.3.2.1  Items that Define Paths
  17936.  
  17937.  
  17938.  
  17939.  
  17940.  
  17941.  
  17942.  
  17943.  
  17944.  
  17945.  
  17946.  
  17947.                                  - 272 -
  17948.  
  17949.  
  17950.  
  17951.            dnl #define(LIBDIR,/usr/local/lib/mail)dnl  # where all support files go
  17952.  
  17953.  
  17954.  
  17955.  
  17956.            LIBDIR  defines  the  directory  where sendmail+IDA expects to find
  17957.       configuration files, the various dbm tables, and special  local  defini-
  17958.       tions.   In  a  typical  binary  distribution, this is compiled into the
  17959.       sendmail binary and does not need to be  explicitly  set  in  the  send-
  17960.       mail.m4 file.
  17961.  
  17962.  
  17963.            The  above  example has a leading dnl which means that this line is
  17964.       essentially a comment for information only.
  17965.  
  17966.  
  17967.            To change the location of the support files to  a  different  loca-
  17968.       tion,  remove  the  leading dnl from the above line, set the path to the
  17969.       desired location, and rebuild and reinstall the sendmail.cf file.
  17970.  
  17971.  
  17972.       16.3.2.2  Defining the Local Mailer
  17973.  
  17974.  
  17975.  
  17976.  
  17977.            define(LOCAL MAILER DEF, mailers.linux)dnl  # mailer for local delivery
  17978.  
  17979.  
  17980.  
  17981.  
  17982.            Most  operating  systems provide a program to handle local delivery
  17983.       of mail.  Typical programs for many of the major variants  of  Unix  are
  17984.       already built into the sendmail binary.
  17985.  
  17986.  
  17987.            In  Linux,  it  is  necessary  to explicitly define the appropriate
  17988.       local mailer since a local delivery program is not  necessarily  present
  17989.       in  the  distribution  you've  installed.   This  is  done by specifying
  17990.       LOCAL MAILER DEF in the sendmail.m4 file.
  17991.  
  17992.  
  17993.              For example, to have the commonly used deliver program(1) provide
  17994.       this service, you would set LOCAL MAILER DEF to mailers.linux.
  17995.  
  17996.  
  17997.            The following file should then be installed as mailers.linux in the
  17998.       directory  pointed to by LIBDIR.  It explicitly defines the deliver pro-
  17999.       gram in the internal Mlocal mailer with the proper parameters to  result
  18000.  
  18001.       
  18002.  
  18003.       1. deliver    was     written     by     Chip     Salzenberg
  18004.          (chip%tct@ateng.com).    It  is  part  of  several  Linux
  18005.          distributions and can be found in the usual anonymous FTP
  18006.          archives such as ftp.uu.net.
  18007.  
  18008.  
  18009.  
  18010.  
  18011.  
  18012.  
  18013.  
  18014.                                  - 273 -
  18015.  
  18016.  
  18017.  
  18018.       in  sendmail  correctly  delivering  mail targeted for the local system.
  18019.       Unless you are a sendmail expert, you probably do not want to alter  the
  18020.       following example.
  18021.  
  18022.  
  18023.  
  18024.            # -- /usr/local/lib/mail/mailers.linux --
  18025.            #     (local mailers for use on Linux )
  18026.            Mlocal, P=/usr/bin/deliver, F=SlsmFDMP, S=10, R=25/10, A=deliver $u
  18027.            Mprog,  P=/bin/sh,       F=lsDFMeuP,   S=10, R=10, A=sh -c $u
  18028.  
  18029.  
  18030.  
  18031.  
  18032.            There  is  a  also  built-in default for deliver in the Sendmail.mc
  18033.       file that gets included into the sendmail.cf file.  To specify  it,  you
  18034.       would  not  use the mailers.linux file and would instead define the fol-
  18035.       lowing in your sendmail.m4 file:
  18036.  
  18037.  
  18038.  
  18039.            dnl --- (in sendmail.m4) ---
  18040.            define(LOCAL MAILER DEF, DELIVER)dnl       # mailer for local delivery
  18041.  
  18042.  
  18043.  
  18044.  
  18045.            Unfortunately, Sendmail.mc assumes deliver is  installed  in  /bin,
  18046.       which  is  not  the  case  with  Slackware1.1.1  (which  installs  it in
  18047.       /usr/bin).  In that case you'd need to either fake it  with  a  link  or
  18048.       rebuild deliver from sources so that it resides in /bin.
  18049.  
  18050.  
  18051.       16.3.2.3  Dealing with Bounced Mail
  18052.  
  18053.  
  18054.  
  18055.  
  18056.            define(POSTMASTERBOUNCE)dnl                # postmaster gets bounces
  18057.  
  18058.  
  18059.  
  18060.  
  18061.            Many sites find that it is important to ensure that  mail  is  sent
  18062.       and  received  with  close to a 100% success rate.  While examining sys-
  18063.       logd(8) logs is helpful, the local mail administrator generally needs to
  18064.       see  the  headers  on bounced mail in order to determine if the mail was
  18065.       undeliverable because of user error or a configuration error on  one  of
  18066.       the systems involved.
  18067.  
  18068.  
  18069.            Defining POSTMASTERBOUNCE results in a copy of each bounced message
  18070.       being set to the person defined as Postmaster for the system.
  18071.  
  18072.  
  18073.  
  18074.  
  18075.  
  18076.  
  18077.  
  18078.  
  18079.  
  18080.                                  - 274 -
  18081.  
  18082.  
  18083.  
  18084.            Unfortunately, setting this parameter also results in the  text  of
  18085.       the  message being sent to the Postmaster, which potentially has related
  18086.       privacy concerns for people using mail on the system.
  18087.  
  18088.  
  18089.            Site postmasters should in general attempt to discipline themselves
  18090.       (or do so via technical means through shell scripts that delete the text
  18091.       of the bounce messages they receive) from reading mail not addressed  to
  18092.       them.
  18093.  
  18094.  
  18095.       16.3.2.4  Domain Name Service Related Items
  18096.  
  18097.            define(PSEUDODOMAINS, BITNET UUCP)dnl       # don't try DNS on these
  18098.  
  18099.  
  18100.  
  18101.  
  18102.            There are several well known networks that are commonly  referenced
  18103.       in  mail addresses for historical reasons but that are not valid for DNS
  18104.       purposes.  Defining PSEUDODOMAINS prevents needless DNS lookup  attempts
  18105.       that will always fail.
  18106.  
  18107.  
  18108.       16.3.2.5  Defining Names the Local System is Known by
  18109.  
  18110.  
  18111.  
  18112.  
  18113.            define(PSEUDONYMS, vstout.vbrew.com  vstout.UUCP vbrew.com)
  18114.            dnl                                         # names we're known by
  18115.            define(DEFAULT HOST, vstout.vbrew.com)dnl   # our primary 'name' for mail
  18116.  
  18117.  
  18118.  
  18119.  
  18120.            Frequently, systems wish to hide their true identity, serve as mail
  18121.       gateways,  or receive and process mail addressed to `old' names by which
  18122.       they used to be known.
  18123.  
  18124.  
  18125.            PSEUDONYMS specifies the list of all hostnames for which the  local
  18126.       system will accept mail.
  18127.  
  18128.  
  18129.            DEFAULT HOST  specifies  the  hostname that will appear in messages
  18130.       originating on the local host.  It is important that this  parameter  be
  18131.       set to a valid value or all return mail will be undeliverable.
  18132.  
  18133.  
  18134.       16.3.2.6  UUCP-Related Items
  18135.  
  18136.  
  18137.  
  18138.  
  18139.  
  18140.  
  18141.  
  18142.  
  18143.  
  18144.  
  18145.  
  18146.                                  - 275 -
  18147.  
  18148.  
  18149.  
  18150.            define(UUCPNAME, vstout)dnl                 # our uucp name
  18151.            define(UUCPNODES, |uuname|sort|uniq)dnl     # our uucp neighbors
  18152.            define(BANGIMPLIESUUCP)dnl                  # make certain that uucp
  18153.            define(BANGONLYUUCP)dnl                     #  mail is treated correctly
  18154.  
  18155.  
  18156.  
  18157.  
  18158.            Frequently,  systems  are  known  by  one name for DNS purposes and
  18159.       another for UUCP purposes.  UUCPNAME permits you to define  a  different
  18160.       hostname that appears in the headers of outgoing UUCP mail.
  18161.  
  18162.  
  18163.            UUCPNODES  defines the commands that return a list of hostnames for
  18164.       the systems we are connected directly to via UUCP connections.
  18165.  
  18166.  
  18167.            BANGIMPLIESUUCP and BANGONLYUUCP ensure that  mail  addressed  with
  18168.       UUCP `bang' syntax is treated according to UUCP behavior rather than the
  18169.       more current Domain Name Service behavior used today on Internet.
  18170.  
  18171.  
  18172.       16.3.2.7  Relay Systems and Mailers
  18173.  
  18174.  
  18175.  
  18176.  
  18177.            define(RELAY HOST, moria)dnl                # our smart relay host
  18178.            define(RELAY MAILER, UUCP-A)dnl             # we reach moria via UUCP
  18179.  
  18180.  
  18181.  
  18182.  
  18183.            Many system administrators do not want to be bothered with the work
  18184.       needed  to  ensure  that  their system is able to reach all the networks
  18185.       (and therefore systems) on all networks worldwide.  Instead of doing so,
  18186.       they  would  rather  relay  all  outgoing mail to another system that is
  18187.       known to be indeed ``smart''.
  18188.  
  18189.  
  18190.            RELAY HOST defines the UUCP hostname of such  a  smart  neighboring
  18191.       system.
  18192.  
  18193.  
  18194.            RELAY MAILER defines the mailer used to relay the messages there.
  18195.  
  18196.  
  18197.            It  is  important  to note that setting these parameters results in
  18198.       your outgoing mail being forwarded to this  remote  system,  which  will
  18199.       affect  the  load of their system.  Be certain to get explicit agreement
  18200.       from the remote Postmaster before  you  configure  your  system  to  use
  18201.       another system as a general purpose relay host.
  18202.  
  18203.  
  18204.  
  18205.  
  18206.  
  18207.  
  18208.  
  18209.  
  18210.  
  18211.  
  18212.                                  - 276 -
  18213.  
  18214.  
  18215.  
  18216.       16.3.2.8  The Various Configuration Tables
  18217.  
  18218.  
  18219.  
  18220.  
  18221.            define(ALIASES, LIBDIR/aliases)dnl          # system aliases
  18222.            define(DOMAINTABLE, LIBDIR/domaintable)dnl  # domainize hosts
  18223.            define(PATHTABLE, LIBDIR/pathtable)dnl      # paths database
  18224.            define(GENERICFROM, LIBDIR/generics)dnl     # generic from addresses
  18225.            define(MAILERTABLE, LIBDIR/mailertable)dnl  # mailers per host or domain
  18226.            define(UUCPXTABLE, LIBDIR/uucpxtable)dnl    # paths to hosts we feed
  18227.            define(UUCPRELAYS, LIBDIR/uucprelays)dnl    # short-circuit paths
  18228.  
  18229.  
  18230.  
  18231.  
  18232.            With these macros, you can change the location  where  sendmail+IDA
  18233.       looks  for  the  various  dbm  tables  that define the system's ``real''
  18234.       behavior.  It is generally wise to leave them in LIBDIR.
  18235.  
  18236.  
  18237.       16.3.2.9  The Master Sendmail.mc File
  18238.  
  18239.            include(Sendmail.mc)dnl                     # REQUIRED ENTRY !!!
  18240.  
  18241.  
  18242.  
  18243.  
  18244.            The authors of sendmail+IDA provide the Sendmail.mc file which con-
  18245.       tains the true ``guts'' of what becomes the sendmail.cf file.   Periodi-
  18246.       cally,  new versions are released to fix bugs or add functionality with-
  18247.       out requiring a full release and recompilation of sendmail from sources.
  18248.  
  18249.  
  18250.            It is important not to edit this file.
  18251.  
  18252.  
  18253.       16.3.2.10  So Which Entries are Really Required?
  18254.  
  18255.  
  18256.  
  18257.            When  not using any of the optional dbm tables, sendmail+IDA deliv-
  18258.       ers  mail  via  the  DEFAULT MAILER   (and   possibly   RELAY HOST   and
  18259.       RELAY MAILER)  defined  in  the  sendmail.m4 file used to generate send-
  18260.       mail.cf.  It is  easily  possible  to  override  this  behavior  through
  18261.       entries in the domaintable or uucpxtable.
  18262.  
  18263.  
  18264.             A generic site that is on Internet and speaks Domain Name Service,
  18265.       or one that is UUCP-only and forwards all mail via UUCP through a  smart
  18266.       RELAY HOST, probably does not need any specific table entries at all.
  18267.  
  18268.  
  18269.            Virtually  all  systems  should set the DEFAULT HOST and PSEUDONYMS
  18270.  
  18271.  
  18272.  
  18273.  
  18274.  
  18275.  
  18276.  
  18277.  
  18278.                                  - 277 -
  18279.  
  18280.  
  18281.  
  18282.       macros, which define the canonical site name and aliases it is known by,
  18283.       and  DEFAULT MAILER.  If  all you have is a relay host and relay mailer,
  18284.       you don't need to set these defaults since it works automagically.
  18285.  
  18286.  
  18287.            UUCP hosts will probably also need to set UUCPNAME to  their  offi-
  18288.       cial   UUCP  name.   They  will  also  probably  set  RELAY MAILER,  and
  18289.       RELAY HOST which enable smart-host routing through a  mail  relay.   The
  18290.       mail  transport to be used is defined in RELAY MAILER and should usually
  18291.       be UUCP-A for UUCP sites.
  18292.  
  18293.  
  18294.            If your site is SMTP-only and  talks  `Domain  Name  Service',  you
  18295.       would  change  the  DEFAULT MAILER  to  TCP-A  and  probably  delete the
  18296.       RELAY MAILER and RELAY HOST lines.
  18297.  
  18298.  
  18299.  
  18300.  
  18301.  
  18302.       16.4  A Tour of Sendmail+IDA Tables
  18303.  
  18304.       Sendmail+IDA provides a number of tables that allow you to override  the
  18305.       default  behavior  of  sendmail  (specified in the sendmail.m4 file) and
  18306.       define special behavior for unique situations, remote systems, and  net-
  18307.       works.  These tables are post-processed with dbm using the Makefile pro-
  18308.       vided with the distribution.
  18309.  
  18310.  
  18311.            Most sites will need few, if any, of these tables.   If  your  site
  18312.       does  not  require  these  tables, the easiest thing is probably to make
  18313.       them zero length files (with the touch  command)  and  use  the  default
  18314.       Makefile in LIBDIR rather than editing the Makefile itself.
  18315.  
  18316.  
  18317.       16.4.1  mailertable
  18318.  
  18319.  
  18320.  
  18321.  
  18322.            The  mailertable  defines  special  treatment for specific hosts or
  18323.       domains based on the remote host or network name.  It is frequently used
  18324.       on  Internet  sites to select an intermediate mail relay host or gateway
  18325.       to reach a remote network through, and to specify a particular  protocol
  18326.       (UUCP  or  SMTP)  to be used.  UUCP sites will generally not need to use
  18327.       this file.
  18328.  
  18329.  
  18330.            Order is important.  Sendmail reads the file top-down and processes
  18331.       the  message  according to the first rule it matches. So it is generally
  18332.       wise to place the most explicit rules at the top of  the  file  and  the
  18333.       more generic rules below.
  18334.  
  18335.  
  18336.  
  18337.  
  18338.  
  18339.  
  18340.  
  18341.  
  18342.  
  18343.  
  18344.                                  - 278 -
  18345.  
  18346.  
  18347.  
  18348.            Suppose  you  want  to  forward  all  mail for the Computer Science
  18349.       department at Groucho Marx University via UUCP  to  a  relay  host  ada.
  18350.       To  do  so, you would have a mailertable entry that looked like the fol-
  18351.       lowing:
  18352.  
  18353.  
  18354.  
  18355.             # (in mailertable)
  18356.             #
  18357.             # forward all mail for the domain .cs.groucho.edu via UUCP to ada
  18358.             UUCP-A,ada         .cs.groucho.edu
  18359.  
  18360.  
  18361.  
  18362.  
  18363.            Suppose you want all mail to the larger groucho.edu domain to go to
  18364.       a  different  relayhost bighub for address resolution and delivery.  The
  18365.       expanded mailertable entries would look quite similar.
  18366.  
  18367.  
  18368.  
  18369.             # (in mailertable)
  18370.             #
  18371.             # forward all mail for the domain cs.groucho.edu via UUCP to ada
  18372.             UUCP-A,ada         .cs.groucho.edu
  18373.             #
  18374.             # forward all mail for the domain groucho.edu via UUCP to bighub
  18375.             UUCP-A,bighub      .groucho.edu
  18376.  
  18377.  
  18378.  
  18379.  
  18380.            As mentioned above, order is important.  Reversing the order of the
  18381.       two  rules  shown above will result in all mail to .cs.groucho.edu going
  18382.       through the more generic bighub path instead of the  explicit  ada  path
  18383.       that is really desired.
  18384.  
  18385.  
  18386.  
  18387.             # (in mailertable)
  18388.             #
  18389.             # forward all mail for the domain .groucho.edu via UUCP to bighub
  18390.             UUCP-A,bighub     .groucho.edu
  18391.             #
  18392.             # (it is impossible to reach the next line because
  18393.             #    the rule above will be matched first)
  18394.             UUCP-A,ada        .cs.groucho.edu
  18395.             #
  18396.  
  18397.  
  18398.  
  18399.  
  18400.            In the mailertable examples above, the UUCP-A mailer makes sendmail
  18401.       use UUCP delivery with domainized headers.
  18402.  
  18403.  
  18404.  
  18405.  
  18406.  
  18407.  
  18408.  
  18409.  
  18410.                                  - 279 -
  18411.  
  18412.  
  18413.  
  18414.            The  comma between the mailer and remote system tells it to forward
  18415.       the message to ada for address resolution and delivery.
  18416.  
  18417.  
  18418.            Mailertable entries are of the format:
  18419.  
  18420.  
  18421.            mailer delimiter relayhost             host or domain
  18422.  
  18423.  
  18424.  
  18425.  
  18426.            There are a number of possible mailers.  The differences are gener-
  18427.       ally in how they treat addresses.  Typical  mailers  are  TCP-A  (TCP/IP
  18428.       with   Internet-style   addresses),   TCP-U   (TCP/IP   with  UUCP-style
  18429.       addresses), and UUCP-A (UUCP with Internet-style addresses).
  18430.  
  18431.  
  18432.            The character that separates the mailer from the  host  portion  on
  18433.       the left-hand-side of a mailertable line defines how the address is mod-
  18434.       ified by the mailertable.  The important thing to realize is  that  this
  18435.       only  rewrites  the  envelope  (to get the mail into the remote system).
  18436.       Rewriting anything other than the envelope is generally frowned upon due
  18437.       to the high probability of breaking the mail configuration.
  18438.  
  18439.  
  18440.  
  18441.  
  18442.               ! An  exclamation point strips off the recipient hostname before
  18443.                 forwarding to the mailer.   This can be used when you want  to
  18444.                 wish  to  essentially  force  mail into a misconfigured remote
  18445.                 site.
  18446.  
  18447.  
  18448.               , A comma does not change the address in any way.   The  message
  18449.                 is  merely forwarded via the specified mailer to the specified
  18450.                 relay host.
  18451.  
  18452.  
  18453.               : A colon removes the  recipient  hostname  only  if  there  are
  18454.                 intermediate  hosts  between  you  and the destination.  Thus,
  18455.                 foo!bar!joe will have  foo  removed,  while  xyzzy!janet  will
  18456.                 remain unchanged.
  18457.  
  18458.  
  18459.  
  18460.       16.4.2  uucpxtable
  18461.  
  18462.  
  18463.  
  18464.  
  18465.            Usually,  mail to hosts with fully-qualified domain names is deliv-
  18466.       ered via Internet style (SMTP) delivery using Domain Name Service (DNS),
  18467.       or  via the relay host.  The uucpxtable forces delivery via UUCP routing
  18468.  
  18469.  
  18470.  
  18471.  
  18472.  
  18473.  
  18474.  
  18475.  
  18476.                                  - 280 -
  18477.  
  18478.  
  18479.  
  18480.       by converting the domainized name into a UUCP-style un-domainized remote
  18481.       hostname.
  18482.  
  18483.  
  18484.            It  is  frequently  used when you're a mail forwarder for a site or
  18485.       domain or when you wish to send mail via a direct and reliable UUCP link
  18486.       rather than potentially multiple hops through the default mailer and any
  18487.       intermediate systems and networks.
  18488.  
  18489.  
  18490.            UUCP sites that talk to UUCP  neighbors  who  use  domainized  mail
  18491.       headers  would  use  this file to force delivery of the mail through the
  18492.       direct UUCP point-to-point link between  the  two  systems  rather  than
  18493.       using  the  less direct route through the RELAY MAILER and RELAY HOST or
  18494.       through the DEFAULT MAILER.
  18495.  
  18496.  
  18497.            Internet sites who do not talk UUCP  probably  would  not  use  the
  18498.       uucpxtable.
  18499.  
  18500.  
  18501.            Suppose  you  provide  mail  forwarding  service to a system called
  18502.       sesame.com in DNS and sesame in the UUCP maps.  You would need the  fol-
  18503.       lowing  uucpxtable entry to force mail for their host to go through your
  18504.       direct UUCP connection.
  18505.  
  18506.  
  18507.  
  18508.            #============== /usr/local/lib/mail/uucpxtable ============
  18509.            # Mail sent to joe@sesame.com is rewritten to sesame!joe and
  18510.            # therefore delivered via UUCP
  18511.            #
  18512.            sesame          sesame.com
  18513.            #
  18514.            #----------------------------------------------------------
  18515.  
  18516.  
  18517.  
  18518.  
  18519.       16.4.3  pathtable
  18520.  
  18521.  
  18522.  
  18523.  
  18524.            The pathtable is used to define explicit routing to remote hosts or
  18525.       networks. The pathtable file should be in pathalias-style syntax, sorted
  18526.       alphabetically.  The two fields on each line must be separated by a real
  18527.       TAB, else dbm might complain.
  18528.  
  18529.  
  18530.            Most systems will not need any pathtable entries.
  18531.  
  18532.  
  18533.  
  18534.  
  18535.  
  18536.  
  18537.  
  18538.  
  18539.  
  18540.  
  18541.  
  18542.                                  - 281 -
  18543.  
  18544.  
  18545.  
  18546.            #=============== /usr/local/lib/mail/pathtable ================
  18547.            #
  18548.            # this is a pathalias-style paths file to let you kick mail to
  18549.            # UUCP neighbors to the direct UUCP path so you don't have to
  18550.            # go the long way through your smart host that takes other traffic
  18551.            #
  18552.            # you want real tabs on each line or m4 might complain
  18553.            #
  18554.            # route mail through one or more intermediate sites to a remote
  18555.            # system using UUCP-style addressing.
  18556.            #
  18557.            sesame!ernie!%s            ernie
  18558.            #
  18559.            # forwarding to a system that is a UUCP neighbor of a reachable
  18560.            # internet site.
  18561.            #
  18562.            swim!%s@gcc.groucho.edu    swim
  18563.            #
  18564.            # The following sends all mail for two networks through different
  18565.            # gateways (see the leading '.' ?).
  18566.            # In this example, "uugate" and "byte" are specific systems that serve
  18567.            # as mail gateways to the .UUCP and .BITNET pseudo-domains respectively
  18568.            #
  18569.            %s@uugate.groucho.edu           .UUCP
  18570.            byte!%s@mail.shift.com          .BITNET
  18571.            #
  18572.            #=================== end of pathtable =======================
  18573.  
  18574.  
  18575.  
  18576.  
  18577.       16.4.4  domaintable
  18578.  
  18579.  
  18580.  
  18581.  
  18582.            The domaintable is generally used to force certain behavior after a
  18583.       DNS lookup has occurred.  It permits the administrator to make shorthand
  18584.       names available for commonly referenced systems or domains by  replacing
  18585.       the  shorthand  name  with the proper one automatically.  It can also be
  18586.       used to replace incorrect host or  domain  names  with  the  ``correct''
  18587.       information.
  18588.  
  18589.  
  18590.            Most sites will not need any domaintable entries.
  18591.  
  18592.  
  18593.            The  following  example  shows  how to replace an incorrect address
  18594.       people are attempting to mail to with the correct address:
  18595.  
  18596.  
  18597.  
  18598.  
  18599.  
  18600.  
  18601.  
  18602.  
  18603.  
  18604.  
  18605.  
  18606.  
  18607.  
  18608.                                  - 282 -
  18609.  
  18610.  
  18611.  
  18612.            #============= /usr/local/lib/mail/domaintable =================
  18613.            #
  18614.            #
  18615.            brokenhost.correct.domain         brokenhost.wrong.domain
  18616.            #
  18617.            #
  18618.            #=================== end of domaintable ========================
  18619.  
  18620.  
  18621.  
  18622.  
  18623.       16.4.5  aliases
  18624.  
  18625.  
  18626.  
  18627.  
  18628.            Aliases permit a number of things to happen:
  18629.  
  18630.  
  18631.  
  18632.  
  18633.               + They provide a shorthand or well-known name  for  mail  to  be
  18634.                 addressed to in order to go to one or more persons.
  18635.  
  18636.               + They  invoke  a  program with the mail message as the input to
  18637.                 the program.
  18638.  
  18639.               + They send mail to a file.
  18640.  
  18641.  
  18642.  
  18643.             All systems require aliases for Postmaster and MAILER-DAEMON to be
  18644.       RFC-compliant.
  18645.  
  18646.  
  18647.            Always  be  extremely  aware of security when defining aliases that
  18648.       invoke programs or write  to  programs  since  sendmail  generally  runs
  18649.       setuid-root.
  18650.  
  18651.  
  18652.            Changes to the aliases file do not take effect until the command
  18653.  
  18654.  
  18655.            # /usr/lib/sendmail -bi
  18656.  
  18657.  
  18658.  
  18659.  
  18660.       is  executed to build the required dbm tables.  This can also be done by
  18661.       executing the newaliases command, usually from cron.
  18662.  
  18663.  
  18664.            Details concerning mail aliases may be found in the aliases(5) man-
  18665.       ual page.
  18666.  
  18667.  
  18668.  
  18669.  
  18670.  
  18671.  
  18672.  
  18673.  
  18674.                                  - 283 -
  18675.  
  18676.  
  18677.  
  18678.            #--------------------- /usr/local/lib/mail/aliases ------------------
  18679.            #
  18680.            # demonstrate commonly seen types of aliases
  18681.            #
  18682.            usenet:         janet                     # alias for a person
  18683.            admin:          joe,janet                 # alias for several people
  18684.            newspak-users:  :include:/usr/lib/lists/newspak
  18685.                                                      # read recipients from a file
  18686.            changefeed:     | /usr/local/lib/gup      # alias that invokes a program
  18687.            complaints:     /var/log/complaints       # alias that writes mail to a file
  18688.            #
  18689.            # The following two aliases must be present to be RFC-compliant.
  18690.            # It is important to have them resolve to 'a person' who reads mail routinely.
  18691.            #
  18692.            postmaster:     root                      # required entry
  18693.            MAILER-DAEMON:  postmaster                # required entry
  18694.            #
  18695.            #-------------------------------------------------------------------
  18696.  
  18697.  
  18698.  
  18699.  
  18700.       16.4.6  Rarely Used Tables
  18701.  
  18702.  
  18703.  
  18704.  
  18705.            The following tables are available, but rather  infrequently  used.
  18706.       Consult  with the documentation that comes with the sendmail+IDA sources
  18707.       for details.
  18708.  
  18709.  
  18710.  
  18711.  
  18712.       uucprelays  The uucprelays file is used to  ``short-circuit''  the  UUCP
  18713.                 path to especially well known sites rather than using a multi-
  18714.                 hop or unreliable path generated by processing the  UUCP  maps
  18715.                 with pathalias.
  18716.  
  18717.  
  18718.       genericfrom and xaliases  The genericfrom file hides local usernames and
  18719.                 addresses from the outside world by  automatically  converting
  18720.                 local  usernames to generic sender addresses that do not match
  18721.                 internal usernames.
  18722.  
  18723.  
  18724.                      The associated xalparse utility automates the  generation
  18725.                 of  the genericfrom and aliases file so that both incoming and
  18726.                 outgoing username translations occur from  a  master  xaliases
  18727.                 file.
  18728.  
  18729.  
  18730.       decnetxtable   The  decnetxtable rewrites domainized addresses into dec-
  18731.                 net-style addresses much like the domaintable can be  used  to
  18732.  
  18733.  
  18734.  
  18735.  
  18736.  
  18737.  
  18738.  
  18739.  
  18740.                                  - 284 -
  18741.  
  18742.  
  18743.  
  18744.                 rewrite  undomainized  addresses  into  domainized  SMTP-style
  18745.                 addresses.
  18746.  
  18747.  
  18748.  
  18749.  
  18750.  
  18751.       16.5  Installing sendmail
  18752.  
  18753.  
  18754.  
  18755.  
  18756.            In this section, we'll take a look at  how  to  install  a  typical
  18757.       binary  distribution  of sendmail+IDA, and walk through what needs to be
  18758.       done to make it localized and functional.
  18759.  
  18760.  
  18761.            The current binary distribution of sendmail+IDA for  Linux  can  be
  18762.       gotten from sunsite.unc.edu in /pub/Linux/system/Mail.  Even if you have
  18763.       an earlier version of sendmail I strongly recommend you go to the  send-
  18764.       mail5.67b+IDA1.5  version  since all required Linux-specific patches are
  18765.       now in the vanilla sources and several significant security  holes  have
  18766.       been plugged that were in versions prior to about December 1, 1993.
  18767.  
  18768.  
  18769.              If  you are building sendmail from the sources, you should follow
  18770.       the instructions in the READMEs included  in  the  source  distribution.
  18771.       The  current  sendmail+IDA  source is available from vixen.cso.uiuc.edu.
  18772.       To build sendmail+IDA on Linux, you also need the Linux-specific config-
  18773.       uration  files  from  newspak-2.2.tar.gz,  which  is  available  on sun-
  18774.       site.unc.edu in the /pub/Linux/system/Mail directory.
  18775.  
  18776.  
  18777.            If you have previously installed smail  or  another  mail  delivery
  18778.       agent,  you'll  probably  want  to remove (or rename) all the files from
  18779.       smail to be safe.
  18780.  
  18781.  
  18782.       16.5.1  Extracting the binary distribution
  18783.  
  18784.       First, you have to unpack the archive file in some safe location:
  18785.  
  18786.  
  18787.  
  18788.            $ gunzip -c sendmail5.65b+IDA1.5+mailx5.3b.tgz | tar xvf -
  18789.  
  18790.  
  18791.  
  18792.  
  18793.            If  you  have a ``modern'' tar, for example from a recent Slackware
  18794.       Distribution, you can probably just do a tar -zxvf filename.tgz and  get
  18795.       the same results.
  18796.  
  18797.  
  18798.  
  18799.  
  18800.  
  18801.  
  18802.  
  18803.  
  18804.  
  18805.  
  18806.                                  - 285 -
  18807.  
  18808.  
  18809.  
  18810.            Unpacking   the   archive   creates   a   directory   named   send-
  18811.       mail5.65b+IDA1.5+mailx5.3b. In  this  directory,  you  find  a  complete
  18812.       installation  of sendmail+IDA plus a binary of the mailx user agent. All
  18813.       file paths below this directory reflect the  location  where  the  files
  18814.       should  be  installed, so it's safe to work up a tar command to move 'em
  18815.       over:
  18816.  
  18817.  
  18818.  
  18819.            # cd sendmail5.65b+IDA1.5+mailx5.3b
  18820.            # tar cf - . | (cd /; tar xvvpoof -)
  18821.  
  18822.  
  18823.  
  18824.  
  18825.       16.5.2  Building sendmail.cf
  18826.  
  18827.  
  18828.  
  18829.  
  18830.            To  build  a sendmail.cf file customized for your site, you have to
  18831.       write   a   sendmail.m4   file,   and   process   it   with   m4.     In
  18832.       /usr/local/lib/mail/CF,  you  find a sample file called sample.m4.  Copy
  18833.       it to yourhostname.m4, and edit it to  reflect  the  situation  of  your
  18834.       site.
  18835.  
  18836.  
  18837.            The  sample file is set up for a UUCP-only site that has domainized
  18838.       headers and talks to a smart host.  Sites like this only need to edit  a
  18839.       few items.
  18840.  
  18841.  
  18842.            In  the  current  section, I will only give a short overview of the
  18843.       macros you have to change. For a complete description of what  they  do,
  18844.       please refer to the earlier discussion of the sendmail.m4.
  18845.  
  18846.  
  18847.  
  18848.  
  18849.       LOCAL MAILER DEF Define  define  the  file  that defines the mailers for
  18850.                 local  mail  delivery.   See  section  ``Defining  the   Local
  18851.                 Mailer'' above for what goes in here.
  18852.  
  18853.  
  18854.       PSEUDONYMS Define all the names your local host is known by.
  18855.  
  18856.  
  18857.       DEFAULT HOST Put  in  your  fully  qualified domain name. This name will
  18858.                 appear as your hostname in all outgoing mail.
  18859.  
  18860.  
  18861.        UUCPNAME Put in your unqualified hostnmae.
  18862.  
  18863.  
  18864.  
  18865.  
  18866.  
  18867.  
  18868.  
  18869.  
  18870.  
  18871.  
  18872.                                  - 286 -
  18873.  
  18874.  
  18875.  
  18876.       RELAY HOST and RELAY MAILER If  you  talk  UUCP  to  a  smart-host,  set
  18877.                 RELAY HOST  to the UUCP name of your `smart relay' uucp neigh-
  18878.                 bor.  Use the UUCP-A mailer if you want domainized headers.
  18879.  
  18880.  
  18881.       DEFAULT MAILER If you are on Internet and talk DNS, you should set  this
  18882.                 to  TCP-A.  This tells sendmail to use the TCP-A mailer, which
  18883.                 delivers mail via SMTP using normal RFC style  addressing  for
  18884.                 the  envelope.   Internet sites probably do not need to define
  18885.                 RELAY HOST or RELAY MAILER.
  18886.  
  18887.  
  18888.  
  18889.  
  18890.  
  18891.            To create the sendmail.cf file, execute the command
  18892.  
  18893.  
  18894.            # make yourhostname.cf
  18895.  
  18896.  
  18897.  
  18898.  
  18899.            This processes the yourhostname.m4 file and creates yourhostname.cf
  18900.       from it.
  18901.  
  18902.  
  18903.            Next, you should test whether the configuration file you've created
  18904.       does what you expect it to do.  This is explained in the  following  two
  18905.       sections.
  18906.  
  18907.  
  18908.            Once  you're  happy  with its behavior, copy it into place with the
  18909.       command:
  18910.  
  18911.  
  18912.            # cp yourhostname.cf /etc/sendmail.cf
  18913.  
  18914.  
  18915.  
  18916.  
  18917.  
  18918.  
  18919.  
  18920.             At this point, your sendmail system is ready for action.  Put  the
  18921.       following    line   in   the   appropriate   startup   file   (generally
  18922.       /etc/rc.inet2).  You can also execute it by hand  to  have  the  process
  18923.       start up now.
  18924.  
  18925.  
  18926.  
  18927.            # /usr/lib/sendmail -bd -q1h
  18928.  
  18929.  
  18930.  
  18931.  
  18932.  
  18933.  
  18934.  
  18935.  
  18936.  
  18937.  
  18938.                                  - 287 -
  18939.  
  18940.  
  18941.  
  18942.       16.5.3  Testing the sendmail.cf file
  18943.  
  18944.  
  18945.  
  18946.  
  18947.            To  put sendmail into `test' mode, you invoke it with the -bt flag.
  18948.       The default configuration file is the sendmail.cf file that is installed
  18949.       on  the  system.  You can test an alternate file by using the -Cfilename
  18950.       option.
  18951.  
  18952.  
  18953.            In the following examples, we  test  vstout.cf,  the  configuration
  18954.       file generated from the vstout.m4 file shown in figure 16.3.1.
  18955.  
  18956.  
  18957.  
  18958.            # /usr/lib/sendmail -bt -Cvstout.cf
  18959.            ADDRESS TEST MODE
  18960.            Enter <ruleset> <address>
  18961.            [Note: No initial ruleset 3 call]
  18962.            >
  18963.  
  18964.  
  18965.  
  18966.  
  18967.            The  following  tests  ensure  that sendmail is able to deliver all
  18968.       mail to users on your system.  In all  cases  the  result  of  the  test
  18969.       should  be  the  same  and point to the local system name with the LOCAL
  18970.       mailer.
  18971.  
  18972.  
  18973.            First test how a mail to a local user would be delivered.
  18974.  
  18975.  
  18976.  
  18977.  
  18978.            # /usr/lib/sendmail -bt -Cvstout.cf
  18979.            ADDRESS TEST MODE
  18980.            Enter <ruleset> <address>
  18981.            [Note: No initial ruleset 3 call]
  18982.            > 3,0 me
  18983.            rewrite: ruleset  3   input: me
  18984.            rewrite: ruleset  7   input: me
  18985.            rewrite: ruleset  9   input: me
  18986.            rewrite: ruleset  9 returns: < me >
  18987.            rewrite: ruleset  7 returns: < > , me
  18988.            rewrite: ruleset  3 returns: < > , me
  18989.            rewrite: ruleset  0   input: < > , me
  18990.            rewrite: ruleset  8   input: < > , me
  18991.            rewrite: ruleset 20   input: < > , me
  18992.            rewrite: ruleset 20 returns: < > , @ vstout . vbrew . com , me
  18993.            rewrite: ruleset  8 returns: < > , @ vstout . vbrew . com , me
  18994.            rewrite: ruleset 26   input: < > , @ vstout . vbrew . com , me
  18995.            rewrite: ruleset 26 returns: $# LOCAL $@ vstout . vbrew . com $: me
  18996.  
  18997.  
  18998.  
  18999.  
  19000.  
  19001.  
  19002.  
  19003.  
  19004.                                  - 288 -
  19005.  
  19006.  
  19007.  
  19008.            rewrite: ruleset  0 returns: $# LOCAL $@ vstout . vbrew . com $: me
  19009.  
  19010.  
  19011.  
  19012.  
  19013.            The output shows how sendmail processes the address internally.  It
  19014.       is handed to various rulesets which analyze it, invoke other rulesets in
  19015.       turn, and break it up into its components.
  19016.  
  19017.  
  19018.            In  our example, we passed the address me to rulesets 3 and 0 (this
  19019.       is the meaning of the 3,0 entered before the address).   The  last  line
  19020.       shows the parsed address as returned by ruleset 0, containing the mailer
  19021.       the message would be delivered by, and the host and user name  given  to
  19022.       the mailer.
  19023.  
  19024.  
  19025.            Next, test mail to a user on your system with UUCP syntax.
  19026.  
  19027.  
  19028.  
  19029.  
  19030.            # /usr/lib/sendmail -bt -Cvstout.cf
  19031.            ADDRESS TEST MODE
  19032.            Enter <ruleset> <address>
  19033.            [Note: No initial ruleset 3 call]
  19034.            > 3,0 vstout!me
  19035.            rewrite: ruleset  3   input: vstout ! me
  19036.            [...]
  19037.            rewrite: ruleset  0 returns: $# LOCAL $@ vstout . vbrew . com  $: me
  19038.            >
  19039.  
  19040.  
  19041.  
  19042.  
  19043.  
  19044.            Next, test mail addressed to a user on your  system  with  Internet
  19045.       syntax to your fully qualified hostname.
  19046.  
  19047.  
  19048.  
  19049.  
  19050.            # /usr/lib/sendmail -bt -Cvstout.cf
  19051.            ADDRESS TEST MODE
  19052.            Enter <ruleset> <address>
  19053.            [Note: No initial ruleset 3 call]
  19054.            > 3,0 me@vstout.vbrew.com
  19055.            rewrite: ruleset  3   input: me @ vstout . vbrew . com
  19056.            [...]
  19057.            rewrite: ruleset  0 returns: $# LOCAL $@ vstout . vbrew . com $: me
  19058.            >
  19059.  
  19060.  
  19061.  
  19062.  
  19063.  
  19064.  
  19065.  
  19066.  
  19067.  
  19068.  
  19069.  
  19070.                                  - 289 -
  19071.  
  19072.  
  19073.  
  19074.            You should repeat the above two tests with each of  the  names  you
  19075.       specified  in  the  PSEUDONYMS and DEFAULT NAME parameters in your send-
  19076.       mail.m4 file.
  19077.  
  19078.  
  19079.            Lastly, test that you can mail to your relay host.
  19080.  
  19081.  
  19082.  
  19083.  
  19084.            # /usr/lib/sendmail -bt -Cvstout.cf
  19085.            ADDRESS TEST MODE
  19086.            Enter <ruleset> <address>
  19087.            [Note: No initial ruleset 3 call]
  19088.            > 3,0 fred@moria.com
  19089.            rewrite: ruleset  3   input: fred @ moria . com
  19090.            rewrite: ruleset  7   input: fred @ moria . com
  19091.            rewrite: ruleset  9   input: fred @ moria . com
  19092.            rewrite: ruleset  9 returns: < fred > @ moria . com
  19093.            rewrite: ruleset  7 returns: < @ moria . com > , fred
  19094.            rewrite: ruleset  3 returns: < @ moria . com > , fred
  19095.            rewrite: ruleset  0   input: < @ moria . com > , fred
  19096.            rewrite: ruleset  8   input: < @ moria . com > , fred
  19097.            rewrite: ruleset  8 returns: < @ moria . com > , fred
  19098.            rewrite: ruleset 29   input: < @ moria . com > , fred
  19099.            rewrite: ruleset 29 returns: < @ moria . com > , fred
  19100.            rewrite: ruleset 26   input: < @ moria . com > , fred
  19101.            rewrite: ruleset 25   input: < @ moria . com > , fred
  19102.            rewrite: ruleset 25 returns: < @ moria . com > , fred
  19103.            rewrite: ruleset  4   input: < @ moria . com > , fred
  19104.            rewrite: ruleset  4 returns: fred @ moria . com
  19105.            rewrite: ruleset 26 returns: < @ moria . com > , fred
  19106.            rewrite: ruleset  0 returns: $# UUCP-A $@ moria $: < @ moria . com > , fred
  19107.            >
  19108.  
  19109.  
  19110.  
  19111.  
  19112.  
  19113.       16.5.4  Putting it all together - Integration Testing sendmail.cf and
  19114.       the tables
  19115.  
  19116.  
  19117.  
  19118.  
  19119.            At this point, you've verified that  mail  will  have  the  desired
  19120.       default  behavior  and  that  you'll  be  able to both send and received
  19121.       validly addressed mail.  To complete the installation, it may be  neces-
  19122.       sary  to  create  the  appropriate  dbm  tables to get the desired final
  19123.       results.
  19124.  
  19125.  
  19126.            After creating the table(s) that are required for  your  site,  you
  19127.       must process them through dbm by typing make in the directory containing
  19128.  
  19129.  
  19130.  
  19131.  
  19132.  
  19133.  
  19134.  
  19135.  
  19136.                                  - 290 -
  19137.  
  19138.  
  19139.  
  19140.       the tables.
  19141.  
  19142.  
  19143.            If you are UUCP-only, you do not need to create any of  the  tables
  19144.       mentioned in the README.linux file.  You'll just have to touch the files
  19145.       so that the Makefile works.
  19146.  
  19147.  
  19148.            If you're UUCP-only and you talk  to  sites  in  addition  to  your
  19149.       smart-host,  you'll  need to add uucpxtable entries for each (or mail to
  19150.       them will also go through the  smart  host)  and  run  dbm  against  the
  19151.       revised uucpxtable.
  19152.  
  19153.  
  19154.            First,  you  need to make certain that mail through your RELAY HOST
  19155.       is sent to them via the RELAY MAILER.
  19156.  
  19157.  
  19158.  
  19159.  
  19160.            # /usr/lib/sendmail -bt -Cvstout.cf
  19161.            ADDRESS TEST MODE
  19162.            Enter <ruleset> <address>
  19163.            [Note: No initial ruleset 3 call]
  19164.            > 3,0 fred@sesame.com
  19165.            rewrite: ruleset  3   input: fred @ sesame . com
  19166.            rewrite: ruleset  7   input: fred @ sesame . com
  19167.            rewrite: ruleset  9   input: fred @ sesame . com
  19168.            rewrite: ruleset  9 returns: < fred > @ sesame . com
  19169.            rewrite: ruleset  7 returns: < @ sesame . com > , fred
  19170.            rewrite: ruleset  3 returns: < @ sesame . com > , fred
  19171.            rewrite: ruleset  0   input: < @ sesame . com > , fred
  19172.            rewrite: ruleset  8   input: < @ sesame . com > , fred
  19173.            rewrite: ruleset  8 returns: < @ sesame . com > , fred
  19174.            rewrite: ruleset 29   input: < @ sesame . com > , fred
  19175.            rewrite: ruleset 29 returns: < @ sesame . com > , fred
  19176.            rewrite: ruleset 26   input: < @ sesame . com > , fred
  19177.            rewrite: ruleset 25   input: < @ sesame . com > , fred
  19178.            rewrite: ruleset 25 returns: < @ sesame . com > , fred
  19179.            rewrite: ruleset  4   input: < @ sesame . com > , fred
  19180.            rewrite: ruleset  4 returns: fred @ sesame . com
  19181.            rewrite: ruleset 26 returns: < @ sesame . com > , fred
  19182.            rewrite: ruleset  0 returns: $# UUCP-A $@ moria $: < @ sesame . com > , fred
  19183.            >
  19184.  
  19185.  
  19186.  
  19187.  
  19188.            If you have UUCP neighbors other than your RELAY HOST, you need  to
  19189.       ensure  that  mail to them has the proper behavior.  Mail addressed with
  19190.       UUCP-style syntax to a host you talk UUCP with  should  go  directly  to
  19191.       them (unless you explicitly prevent it with a domaintable entry). Assume
  19192.       host swim is a direct UUCP neighbor of yours. Then feeding swim!fred  to
  19193.       sendmail should produce the following result:
  19194.  
  19195.  
  19196.  
  19197.  
  19198.  
  19199.  
  19200.  
  19201.  
  19202.                                  - 291 -
  19203.  
  19204.  
  19205.  
  19206.            # /usr/lib/sendmail -bt -Cvstout.cf
  19207.            ADDRESS TEST MODE
  19208.            Enter <ruleset> <address>
  19209.            [Note: No initial ruleset 3 call]
  19210.            > 3,0 swim!fred
  19211.            rewrite: ruleset  3   input: swim ! fred
  19212.            [...lines omitted...]
  19213.            rewrite: ruleset  0 returns: $# UUCP $@ swim $: < > , fred
  19214.            >
  19215.  
  19216.  
  19217.  
  19218.  
  19219.            If you have uucpxtable entries to force UUCP  delivery  to  certain
  19220.       UUCP  neighbors who send their mail with Internet style domainized head-
  19221.       ers, that also needs to be tested.
  19222.  
  19223.  
  19224.  
  19225.  
  19226.            # /usr/lib/sendmail -bt -Cvstout.cf
  19227.            ADDRESS TEST MODE
  19228.            Enter <ruleset> <address>
  19229.            [Note: No initial ruleset 3 call]
  19230.            > 3,0 dude@swim.2birds.com
  19231.            rewrite: ruleset  3   input: dude @ swim . 2birds . com
  19232.            [...lines omitted...]
  19233.            rewrite: ruleset  0 returns: $# UUCP $@ swim . 2birds $: < > , dude
  19234.            >
  19235.  
  19236.  
  19237.  
  19238.  
  19239.  
  19240.  
  19241.  
  19242.  
  19243.       16.6  Administrivia and Stupid Mail Tricks
  19244.  
  19245.       Now  that  we've  discussed  the  theory of configuring, installing, and
  19246.       testing a sendmail+IDA system, lets take a  few  moments  to  look  into
  19247.       things that do happen routinely in the life of a mail administrator.
  19248.  
  19249.  
  19250.            Remote  systems  sometimes  break.  Modems or phone lines fail, DNS
  19251.       definitions are set incorrectly due to human error.   Networks  go  down
  19252.       unexpectedly.   In  such  cases, mail administrators need to know how to
  19253.       react quickly, effectively, and safely  to  keep  mail  flowing  through
  19254.       alternate  routes  until  the  remote  systems  or service providers can
  19255.       restore normal services.
  19256.  
  19257.  
  19258.            The rest of this chapter is intended to provide you with the  solu-
  19259.       tions   to   the   most   frequently   encountered   ``electronic   mail
  19260.  
  19261.  
  19262.  
  19263.  
  19264.  
  19265.  
  19266.  
  19267.  
  19268.                                  - 292 -
  19269.  
  19270.  
  19271.  
  19272.       emergencies''.
  19273.  
  19274.  
  19275.       16.6.1  Forwarding Mail to a Relay Host
  19276.  
  19277.  
  19278.  
  19279.  
  19280.            To forward mail for a particular host or  domain  to  a  designated
  19281.       relay system, you generally use the mailertable.
  19282.  
  19283.  
  19284.            For example, to forward mail for backwood.org to their UUCP gateway
  19285.       system backdoor, you'd put the following entry into mailertable:
  19286.  
  19287.  
  19288.  
  19289.             UUCP-A,backdoor   backwood.org
  19290.  
  19291.  
  19292.  
  19293.  
  19294.       16.6.2  Forcing Mail into Misconfigured Remote Sites
  19295.  
  19296.  
  19297.  
  19298.  
  19299.            Frequently, Internet hosts will have trouble getting mail into mis-
  19300.       configured  remote  sites.   There are several variants of this problem,
  19301.       but the general symptom is that mail is bounced by the remote system  or
  19302.       never gets there at all.
  19303.  
  19304.  
  19305.            These  problems  can  put  the  local system administrator in a bad
  19306.       position because your users generally don't care that you don't  person-
  19307.       ally  administer  every  system worldwide (or know how to get the remote
  19308.       administrator to fix the problem).   They  just  know  that  their  mail
  19309.       didn't  get  through  to the desired recipient on the other end and that
  19310.       you're a likely person to complain to.
  19311.  
  19312.  
  19313.            A remote site's configuration is their problem, not yours.  In  all
  19314.       cases,  be certain to not break your site in order to communicate with a
  19315.       misconfigured remote site. If you can't get in touch with the Postmaster
  19316.       at  the  remote  site to get them to fix their configuration in a timely
  19317.       manner, you have two options.
  19318.  
  19319.  
  19320.  
  19321.  
  19322.               + It is generally possible to force mail into the remote  system
  19323.                 successfully,  although  since the remote system is misconfig-
  19324.                 ured, replies on the remote  end  might  not  work...but  then
  19325.                 that's the remote administrator's problem.
  19326.  
  19327.  
  19328.  
  19329.  
  19330.  
  19331.  
  19332.  
  19333.  
  19334.                                  - 293 -
  19335.  
  19336.  
  19337.  
  19338.                      You  can fix the bad headers in the envelope on your out-
  19339.                 going messages only by using a  domaintable  entry  for  their
  19340.                 host/domain that results in the invalid information being cor-
  19341.                 rected in mail originating from your site:
  19342.  
  19343.  
  19344.  
  19345.                               braindead.correct.domain.com        braindead.wrong.domain.com
  19346.  
  19347.  
  19348.  
  19349.  
  19350.               + Frequently, misconfigured sites  `bounce'  mail  back  to  the
  19351.                 sending  system and effectively say ``that mail isn't for this
  19352.                 site'' because they do not have their PSEUDONYMNS  or  equiva-
  19353.                 lent  set  properly in their configuration.  It is possible to
  19354.                 totally strip off all hostname and domain information from the
  19355.                 envelope of messages going from your site to them.
  19356.  
  19357.  
  19358.                      The ! in the following mailertable delivers mail to their
  19359.                 remote site making it appear to their sendmail as  if  it  had
  19360.                 originated  locally  on  their system.  Note that this changes
  19361.                 only the envelope address, so the proper return  address  will
  19362.                 still show up in the message.
  19363.  
  19364.  
  19365.  
  19366.                               TCP!braindead.correct.domain.com   braindead.wrong.domain.com
  19367.  
  19368.  
  19369.  
  19370.  
  19371.  
  19372.            Regardless,  even  if  you  get mail into their system, there is no
  19373.       guarantee that they can reply to your message  (they're  broken,  remem-
  19374.       ber...)  but then their users are yelling at their administrators rather
  19375.       than your users yelling at you.
  19376.  
  19377.  
  19378.       16.6.3  Forcing Mail to be Transferred via UUCP
  19379.  
  19380.  
  19381.  
  19382.  
  19383.            In an ideal world (from the Internet perspective), all  hosts  have
  19384.       records  in  the Domain Name Service (DNS) and will send mail with fully
  19385.       qualified domain names.
  19386.  
  19387.  
  19388.            If you happen to talk via UUCP to such a site, you can  force  mail
  19389.       to  go  through  the  point-to-point UUCP connection rather than through
  19390.       your default mailer  by  essentially  ``undomainizing''  their  hostname
  19391.       through the uucpxtable.
  19392.  
  19393.  
  19394.  
  19395.  
  19396.  
  19397.  
  19398.  
  19399.  
  19400.                                  - 294 -
  19401.  
  19402.  
  19403.  
  19404.            To  force  UUCP delivery to sesame.com, you would put the following
  19405.       in your uucpxtable:
  19406.  
  19407.  
  19408.  
  19409.             # un-domainize sesame.com to force UUCP delivery
  19410.             sesame    sesame.com
  19411.  
  19412.  
  19413.  
  19414.  
  19415.            The  result  is that sendmail will then determine (via UUCPNODES in
  19416.       the sendmail.m4 file) that you are directly connected to the remote sys-
  19417.       tem and will queue the mail for delivery with UUCP.
  19418.  
  19419.  
  19420.       16.6.4  Preventing Mail from Being Delivered via UUCP
  19421.  
  19422.  
  19423.  
  19424.  
  19425.            The  opposite condition also occurs. Frequently, systems may have a
  19426.       number of direct UUCP connections that are used infrequently or that are
  19427.       not  as  reliable  and  always  available as the default mailer or relay
  19428.       host.
  19429.  
  19430.  
  19431.            For example, in the Seattle area there are a number of systems that
  19432.       exchange  the  various  Linux  distributions via anonymous UUCP when the
  19433.       distributions are released.  These systems talk UUCP  only  when  neces-
  19434.       sary,  so  it is generally faster and more reliable to send mail through
  19435.       multiple very reliable hops and  common  (and  always  available)  relay
  19436.       hosts.
  19437.  
  19438.  
  19439.            It  is  easily  possible to prevent UUCP delivery of mail to a host
  19440.       that you are directly connected to. If the remote system  has  a  fully-
  19441.       qualified   domain  name,  you  can  add  an  entry  like  this  to  the
  19442.       domaintable:
  19443.  
  19444.  
  19445.  
  19446.             # prevent mail delivery via UUCP to a neighbor
  19447.             snorkel.com       snorkel
  19448.  
  19449.  
  19450.  
  19451.  
  19452.            This will replace any occurence of the UUCP name with the FQDN, and
  19453.       thus prevent a match by the UUCPNODES line in the sendmail.m4 file.  The
  19454.       result  is  generally  that  mail  will  go  via  the  RELAY MAILER  and
  19455.       RELAY HOST (or DEFAULT MAILER).
  19456.  
  19457.  
  19458.  
  19459.  
  19460.  
  19461.  
  19462.  
  19463.  
  19464.  
  19465.  
  19466.                                  - 295 -
  19467.  
  19468.  
  19469.  
  19470.       16.6.5  Running the Sendmail Queue on Demand
  19471.  
  19472.  
  19473.  
  19474.  
  19475.            To   process   queued    messages    immediately,    merely    type
  19476.       '/usr/lib/runq'.  This  invokes sendmail with the appropriate options to
  19477.       cause sendmail to run through the  queue  of  pending  jobs  immediately
  19478.       rather than waiting for the next scheduled run.
  19479.  
  19480.  
  19481.       16.6.6  Reporting Mail Statistics
  19482.  
  19483.  
  19484.  
  19485.  
  19486.            Many site administrators (and the persons they work for) are inter-
  19487.       ested in the volume of mail passing to,  from,  and  through  the  local
  19488.       site.  There are a number of ways to quantify mail traffic.
  19489.  
  19490.  
  19491.  
  19492.  
  19493.               + Sendmail  comes  with  a utility called mailstats that reads a
  19494.                 file called /usr/local/lib/mail/sendmail.st  and  reports  the
  19495.                 number  of messages and number of bytes transferred by each of
  19496.                 the mailers used in the sendmail.cf file.   This file must  be
  19497.                 created  by the local administrator manually for sendmail log-
  19498.                 ging to occur. The running totals are cleared by removing  and
  19499.                 recreating the sendmail.st file.  One way is to do the follow-
  19500.                 ing:
  19501.  
  19502.  
  19503.                      # cp /dev/null /usr/lib/local/mail/sendmail.st
  19504.  
  19505.  
  19506.  
  19507.  
  19508.               + Probably  the  best  way to do quality reporting regarding who
  19509.                 uses mail and how much volume passes to, from, and through the
  19510.                 local  system  is  to  turn on mail debugging with syslogd(8).
  19511.                 Generally, this means running  the  /etc/syslogd  daemon  from
  19512.                 your  system  startup file (which you should be doing anyway),
  19513.                 and adding a line to /etc/syslog.conf(5) that looks  something
  19514.                 like the following:
  19515.  
  19516.  
  19517.  
  19518.                              mail.debug                         /var/log/syslog.mail
  19519.  
  19520.  
  19521.  
  19522.  
  19523.                      If you use mail.debug and get any  medium  to  high  mail
  19524.  
  19525.  
  19526.  
  19527.  
  19528.  
  19529.  
  19530.  
  19531.  
  19532.                                  - 296 -
  19533.  
  19534.  
  19535.  
  19536.                 volume,  the  syslog output can get quite large.  Output files
  19537.                 from syslogd generally need to be rotated or purged on a  rou-
  19538.                 tine basis from crond(8).
  19539.  
  19540.  
  19541.                      There  are  a number of commonly available utilities that
  19542.                 can summarize the output of mail logging from syslogd.  One of
  19543.                 the more well known utilities is syslog-stat.pl, a perl script
  19544.                 that is distributed with the sendmail+IDA sources.
  19545.  
  19546.  
  19547.  
  19548.  
  19549.  
  19550.       16.7  Mixing and Matching Binary Distributions
  19551.  
  19552.  
  19553.  
  19554.  
  19555.            There is no true standard configuration of electronic  mail  trans-
  19556.       port  and  delivery  agents  and there is no ``one true directory struc-
  19557.       ture.''
  19558.  
  19559.  
  19560.            Accordingly, it is necessary to ensure that all the various  pieces
  19561.       of  the  system (USENET news, mail, TCP/IP) agree on the location of the
  19562.       local mail delivery program (lmail, deliver, etc.), remote mail delivery
  19563.       program  (rmail),  and  the  mail transport program (sendmail or smail).
  19564.       Such assumptions are not  generally  documented,  although  use  of  the
  19565.       strings  command  can  help  determine  what  files  and directories are
  19566.       expected.  The following are some problems we've seen in the  past  with
  19567.       some of the commonly available Linux binary distributions and sources.
  19568.  
  19569.  
  19570.  
  19571.  
  19572.               + Some  versions  of  the NET-2 distribution of TCP/IP have ser-
  19573.                 vices defined for a program called umail rather than sendmail.
  19574.  
  19575.  
  19576.               + There  are  various  ports  of  elm  and mailx that look for a
  19577.                 delivery agent of /usr/bin/smail rather than sendmail.
  19578.  
  19579.  
  19580.               + Sendmail+IDA has a built-in  local  mailer  for  deliver,  but
  19581.                 expects  it to be located in /bin rather than the more typical
  19582.                 Linux location of /usr/bin.
  19583.  
  19584.  
  19585.  
  19586.  
  19587.  
  19588.            Rather than go through the trouble of building all the mail clients
  19589.       from sources, we generally fake it with the appropriate soft links...
  19590.  
  19591.  
  19592.  
  19593.  
  19594.  
  19595.  
  19596.  
  19597.  
  19598.                                  - 297 -
  19599.  
  19600.  
  19601.  
  19602.       16.8  Where to Get More Information
  19603.  
  19604.       There  are  many  places  you can look for more information on sendmail.
  19605.       For a list, see the Linux MAIL Howto posted regularly  to  comp.answers.
  19606.       It  is  also  available  for anonymous FTP on rtfm.mit.edu. However, the
  19607.       definitive place is in the sendmail+IDA sources.  Look in the  directory
  19608.       ida/cf  below the source directory for the files DBM-GUIDE, OPTIONS, and
  19609.       Sendmail.mc.
  19610.  
  19611.  
  19612.  
  19613.  
  19614.  
  19615.  
  19616.  
  19617.  
  19618.  
  19619.  
  19620.  
  19621.  
  19622.  
  19623.  
  19624.  
  19625.  
  19626.  
  19627.  
  19628.  
  19629.  
  19630.  
  19631.  
  19632.  
  19633.  
  19634.  
  19635.  
  19636.  
  19637.  
  19638.  
  19639.  
  19640.  
  19641.  
  19642.  
  19643.  
  19644.  
  19645.  
  19646.  
  19647.  
  19648.  
  19649.  
  19650.  
  19651.  
  19652.  
  19653.  
  19654.  
  19655.  
  19656.  
  19657.  
  19658.  
  19659.  
  19660.  
  19661.  
  19662.  
  19663.  
  19664.                                  - 298 -
  19665.  
  19666.  
  19667.  
  19668.       17.  Netnews
  19669.  
  19670.       17.1  Usenet History
  19671.  
  19672.  
  19673.  
  19674.  
  19675.            The idea of network news was born in 1979 when  two  graduate  stu-
  19676.       dents,  Tom  Truscott  and  Jim  Ellis, thought of using UUCP to connect
  19677.       machines for the purpose of information exchange among Un*x users.  They
  19678.       set up a small network of three machines in North Carolina.
  19679.  
  19680.  
  19681.            Initially,  traffic was handled by a number of shell scripts (later
  19682.       rewritten in C), but they were never released to the public.  They  were
  19683.       quickly  replaced  by ``A'' news, the first public release of news soft-
  19684.       ware.
  19685.  
  19686.  
  19687.            ``A'' news was not designed to handle more than a few articles  per
  19688.       group  and  day.  When the volume continued to grow, it was rewritten by
  19689.       Mark Horton and Matt Glickman, who called it the ``B''  release  (a.k.a.
  19690.       Bnews).  The  first  public release of Bnews was version 2.1 in 1982. It
  19691.       was expanded continuously, with several new features  being  added.  Its
  19692.       current  version is Bnews 2.11. It is slowly becoming obsolete, with its
  19693.       last official maintainer having switched to INN.
  19694.  
  19695.  
  19696.             Another rewrite was done and released in 1987 by Geoff Collyer and
  19697.       Henry  Spencer;  this is release ``C'', or C News. In the time following
  19698.       there have been a number of patches to C News, the most prominent  being
  19699.       the  C  News  Performance Release. On sites that carry a large number of
  19700.       groups, the overhead involved in frequently invoking relaynews, which is
  19701.       responsible for dispatching incoming articles to other hosts, is signif-
  19702.       icant. The Performance Release adds an option to relaynews  that  allows
  19703.       to  run it in daemon mode, in which the program puts itself in the back-
  19704.       ground.
  19705.  
  19706.  
  19707.            The Performance Release is the C News version currently included in
  19708.       most Linux releases.
  19709.  
  19710.  
  19711.             All news releases up to ``C'' are primarily targeted for UUCP net-
  19712.       works, although they may be used in other environments as  well.   Effi-
  19713.       cient  news  transfer  over  networks  like  TCP/IP,  DECNet, or related
  19714.       requires a new scheme. This was the reason why, in 1986,  the  ``Network
  19715.       News  Transfer  Protocol'', NNTP, was introduced. It is based on network
  19716.       connections, and specifies a number of commands to interactively  trans-
  19717.       fer and retrieve articles.
  19718.  
  19719.  
  19720.            There  are  a  number of NNTP-based applications available from the
  19721.       Net. One of them is the nntpd package by Brian Barber and Phil  Lapsley,
  19722.  
  19723.  
  19724.  
  19725.  
  19726.  
  19727.  
  19728.  
  19729.  
  19730.                                  - 299 -
  19731.  
  19732.  
  19733.  
  19734.       which  you  can use, among other things, to provides newsreading service
  19735.       to a number of hosts inside a local network. nntpd was designed to  com-
  19736.       plement  news  packages  such  as Bnews or C News to give them NNTP fea-
  19737.       tures.
  19738.  
  19739.  
  19740.             A different NNTP package is INN,  or  Internet  News.  It  is  not
  19741.       merely  a  front end, but a news system by its own right. It comprises a
  19742.       sophisticated news relay daemon that is capable of  maintaining  several
  19743.       concurrent  NNTP  links efficiently, and is therefore the news server of
  19744.       choice for many Internet sites.
  19745.  
  19746.  
  19747.       17.2  What is Usenet, Anyway?
  19748.  
  19749.  
  19750.  
  19751.  
  19752.            One of the most astounding facts about Usenet is that it isn't part
  19753.       of  any  organization, or has any sort of centralized network management
  19754.       authority. In fact, it's part of Usenet lore that except for a technical
  19755.       description,  you  cannot  define  what  it is, you can only say what it
  19756.       isn't. If you have Brendan Kehoe's excellent ``Zen and the  Art  of  the
  19757.       Internet'' (available online or through Prentice-Hall, see [ GETST "zen"
  19758.       ]) at hand, you will find an amusing list of Usenet's non-properties.
  19759.  
  19760.  
  19761.             At the risk of sounding stupid, one might define Usenet as a  col-
  19762.       laboration  of  separate sites who exchange Usenet news.  To be a Usenet
  19763.       site, all you have to do is find another site Usenet site, and strike an
  19764.       agreement  with  its  owners  and maintainers to exchange news with you.
  19765.       Providing another site with news  is  also  called  feeding  it,  whence
  19766.       another  common  axiom of Usenet philosophy originates: ``Get a feed and
  19767.       you're on it.''
  19768.  
  19769.  
  19770.             The basic unit of Usenet news is the article. This is a message  a
  19771.       user  writes and ``posts'' to the net. In order to enable news sytems to
  19772.       deal with it, it is prepended with administrative information,  the  so-
  19773.       called article header. It is very similar to the mail header format laid
  19774.       down in the Internet mail standard RFC 822, in that it consists of  sev-
  19775.       eral  lines  of  text,  each beginning with a field name terminated by a
  19776.       colon, which is followed by the field's value.(1)
  19777.  
  19778.  
  19779.              Articles  are  submitted to one or more newsgroups.  One may con-
  19780.       sider a newsgroup a forum for articles relating to a common topic.   All
  19781.       newsgroups are organized in a hierarchy, with each group's name indicat-
  19782.       ing its place in the hierarchy. This often makes it easy to see  what  a
  19783.       group is all about. For example, anybody can see from the newsgroup name
  19784.       that comp.os.linux.announce  is  used  for  announcements  concerning  a
  19785.  
  19786.       
  19787.  
  19788.       1. The format of Usenet news messages is  specified  in  RFC
  19789.          1036, ``Standard for interchange of USENET messages''.
  19790.  
  19791.  
  19792.  
  19793.  
  19794.  
  19795.  
  19796.  
  19797.                                  - 300 -
  19798.  
  19799.  
  19800.  
  19801.       computer operating system named Linux.
  19802.  
  19803.  
  19804.              These  articles  are then exchanged between all Usenet sites that
  19805.       are willing to carry news from this group.   When  two  sites  agree  to
  19806.       exchange  news,  they are free to exchange whatever newsgroups they like
  19807.       to, and may even add their own  local  news  hierarchies.  For  example,
  19808.       groucho.edu  might  have  a  news link to barnyard.edu, which is a major
  19809.       news feed, and several links to minor sites which it  feeds  news.  Now,
  19810.       Barnyard  College  might receive all Usenet groups, while GMU only wants
  19811.       to carry a few major hierarchies like sci, comp, rec, etc. Some  of  the
  19812.       downstream sites, say a UUCP site called brewhq, will want to carry even
  19813.       fewer groups, because they don't have the network or hardware resources.
  19814.       On  the  other hand, brewhq might want to receive newsgroups from the fj
  19815.       hierarchy, which GMU doesn't carry. It therefore maintains another  link
  19816.       with  gargleblaster.com,  who  carry  all  fj  groups,  and feed them to
  19817.       brewhq. The news flow is shown in figure 17.2.
  19818.  
  19819.  
  19820.  
  19821.  
  19822.  
  19823.            The labels on the arrows originating from brewhq may  require  some
  19824.       explanation, though.  By default, it wants all locally generated news to
  19825.       be sent to groucho.edu.  However, as groucho.edu does not carry  the  fj
  19826.       groups,  there's  no  pointing  in  sending  it  any messages from those
  19827.       groups.  Therefore, the feed from brewhq to  GMU  is  labelled  all,!fj,
  19828.       meaning that all groups except those below fj are sent to it.
  19829.  
  19830.  
  19831.       17.3  How Does Usenet Handle News?
  19832.  
  19833.  
  19834.  
  19835.  
  19836.            Today,  Usenet  has grown to enormous proportions. Sites that carry
  19837.       the whole of netnews usually transfer  something  like  a  paltry  sixty
  19838.       megabytes a day.(2) Of course  this  requires  much  more  than  pushing
  19839.       around  files.  So let's take a look at the way most Un*x systems handle
  19840.       Usenet news.
  19841.  
  19842.  
  19843.             News is distributed through the net  by  various  transports.  The
  19844.       historical medium used to be UUCP, but today the main traffic is carried
  19845.       by Internet sites. The routing algorithm used is called  flooding:  Each
  19846.       site maintains a number of links (news feeds) to other sites.  Any arti-
  19847.       cle generated or received by the local news system is forwarded to them,
  19848.       unless  it  has already been seen at that site, in which case it is dis-
  19849.       carded. A site may find out  about  all  other  sites  the  article  has
  19850.       already traversed by looking at the Path: header field. This header con-
  19851.       tains a list of all systems the article has been forwarded  by  in  bang
  19852.  
  19853.       
  19854.  
  19855.       2. Wait  a moment: 60 Megs at 9600 bps, that's 60 million by
  19856.          1200, that is...mutter, mutter,...Hey! That's 34 hours!
  19857.  
  19858.  
  19859.  
  19860.  
  19861.  
  19862.  
  19863.  
  19864.                                  - 301 -
  19865.  
  19866.  
  19867.  
  19868.  
  19869.  
  19870.  
  19871.  
  19872.       Figure 21.   Usenet news flow through Groucho Marx University.
  19873.  
  19874.  
  19875.       path notation.
  19876.  
  19877.  
  19878.              To distinguish articles and recognize duplicates, Usenet articles
  19879.       have to carry a message id (specified in the Message-Id: header  field),
  19880.       which  combines  the  posting  site's  name  and  a  serial  number into
  19881.       ``<serial@site>''. For each article processed, the news system logs this
  19882.       id  into  a  history  file  against which all newly arrived articles are
  19883.       checked.
  19884.  
  19885.  
  19886.             The flow between any two sites may be limited by two criteria: for
  19887.       one,  an article is assigned a distribution (in the Distribution: header
  19888.       field) which may be used to confine it to a certain group of sites.   On
  19889.       the  other  hand,  the  newsgroups  exchanged may be limited by both the
  19890.       sending or receiving system.  The set of  newsgroups  and  distributions
  19891.       allowed for transmission to a site are usually kept in the sys file.
  19892.  
  19893.  
  19894.             The sheer number of articles usually requires that improvements be
  19895.       made to the above scheme. On UUCP networks, the natural thing to  do  is
  19896.       to  collect articles over a period of time, and combine them into a sin-
  19897.       gle file, which is compressed and sent  to  the  remote  site.  This  is
  19898.       called batching.(3)
  19899.  
  19900.  
  19901.             An alternative technique is the ihave/sendme  protocol  that  pre-
  19902.       vents duplicate articles from being transferred in the first place, thus
  19903.       saving net bandwidth. Instead of putting all articles in batch files and
  19904.       sending them along, only the message ids of articles are combined into a
  19905.       giant ``ihave'' message and sent to the remote site.  It reads this mes-
  19906.       sage,  compares it to its history file, and returns the list of articles
  19907.       it wants in a ``sendme'' message. Only these articles are then sent.
  19908.  
  19909.  
  19910.            Of course, ihave/sendme only makes sense if  it  involves  two  big
  19911.       sites  that  receive  news  from several independent feeds each, and who
  19912.       poll each other often enough for an efficient flow of news.
  19913.  
  19914.  
  19915.             Sites that are on the  Internet  generally  rely  on  TCP/IP-based
  19916.       software  that  uses  the  Network  News  Transfer Protocol, NNTP.(4) It
  19917.       transfers news between feeds and provides Usenet access to single  users
  19918.  
  19919.       
  19920.  
  19921.       3. The  golden  rule of netnews, according to Geoff Collyer:
  19922.          ``Thou shalt batch thine articles.''
  19923.       4. Described in RFC 977.
  19924.  
  19925.  
  19926.  
  19927.  
  19928.  
  19929.  
  19930.  
  19931.                                  - 302 -
  19932.  
  19933.  
  19934.  
  19935.       on remote hosts.
  19936.  
  19937.  
  19938.              NNTP  knows three different ways to transfer news. One is a real-
  19939.       time version of ihave/sendme, also referred to as pushing news. The sec-
  19940.       ond  technique  is  called  pulling news, in which the client requests a
  19941.       list of articles in a given newsgroup or hierarchy that have arrived  at
  19942.       the  server's  site  after a specified date, and chooses those it cannot
  19943.       find in its history file.  The third mode is for  interactive  newsread-
  19944.       ing,  and allows you or your newsreader to retrieve articles from speci-
  19945.       fied newgroups, as well as post articles with incomplete header informa-
  19946.       tion.
  19947.  
  19948.  
  19949.  
  19950.  
  19951.  
  19952.              At  each  site,  news  are  kept  in  a directory hierarchy below
  19953.       /var/spool/news, each article in a separate file, and each newsgroup  in
  19954.       a  separate  directory.   The directory name is made up of the newsgroup
  19955.       name,  with  the   components   being   the   path   components.   Thus,
  19956.       comp.os.linux.misc          articles         are         kept         in
  19957.       /var/spool/news/comp/os/linux/misc. The  articles  in  a  newsgroup  are
  19958.       assigned  numbers  in  the  order they arrive. This number serves as the
  19959.       file's name.  The range of numbers of articles currently online is  kept
  19960.       in  a  file  called  active,  which at the same time serves as a list of
  19961.       newsgroups known at your site.
  19962.  
  19963.  
  19964.              Since disk space is a finite resource,(5) one has to start throw-
  19965.       ing away articles after some time. This  is  called  expiring.  Usually,
  19966.       articles from certain groups and hierarchies are expired at a fixed num-
  19967.       ber of days after they arrive.  This may be overridden by the poster  by
  19968.       specifying  a  date  of  expiration in the Expires: field of the article
  19969.       header.
  19970.  
  19971.  
  19972.  
  19973.  
  19974.  
  19975.  
  19976.  
  19977.  
  19978.  
  19979.  
  19980.  
  19981.  
  19982.  
  19983.  
  19984.  
  19985.  
  19986.  
  19987.       
  19988.  
  19989.       5. Some people claim that Usenet is a  conspiracy  by  modem
  19990.          and hard disk vendors.
  19991.  
  19992.  
  19993.  
  19994.  
  19995.  
  19996.  
  19997.  
  19998.                                  - 303 -
  19999.  
  20000.  
  20001.  
  20002.       18.  C News
  20003.  
  20004.  
  20005.  
  20006.  
  20007.            One of the most popular software packages for Netnews is C News. It
  20008.       was  designed  for  sites  that carry news over UUCP links. This chapter
  20009.       will discuss the central concepts of C News, and the basic  installation
  20010.       and maintenance tasks.
  20011.  
  20012.  
  20013.              C  News stores its configuration files in /usr/lib/news, and most
  20014.       of its binaries in the /usr/lib/news/bin directory.  Articles  are  kept
  20015.       below /var/spool/news. You should make sure virtually all files in these
  20016.       directories are owned by user news, group news. Most problems arise from
  20017.       files  being  inaccessible  to  C News. Make it a rule for you to become
  20018.       user news using su before you touch anything in there.  The only  excep-
  20019.       tions  is setnewsids, which is used to set the real user id of some news
  20020.       programs. It must be owned by root and must have the setuid bit set.
  20021.  
  20022.  
  20023.            In the following, we describe all C  News  configuration  files  in
  20024.       detail, and show you what you have to do to keep your site running.
  20025.  
  20026.  
  20027.       18.1  Delivering News
  20028.  
  20029.  
  20030.  
  20031.  
  20032.              Articles  may be fed to C News in several ways. When a local user
  20033.       posts an article, the newsreader usually hands it to the inews  command,
  20034.       which  completes the header information. News from remote sites, be it a
  20035.       single article or a whole batch, is given to the  rnews  command,  which
  20036.       stores  it in the /var/spool/newsin.coming directory, from where it will
  20037.       be picked up at a later time by newsrun. With any  of  these  two  tech-
  20038.       niques,  however, the article will eventually be handed to the relaynews
  20039.       command.
  20040.  
  20041.  
  20042.             For each article, the relaynews command first checks if the  arti-
  20043.       cle has already been seen at the local site by looking up the message id
  20044.       in the history file. Duplicate articles will be dropped. Then, relaynews
  20045.       looks  at  the  Newsgroups:  header  line  to find out if the local site
  20046.       requests articles from any of these groups.  If it does, and  the  news-
  20047.       group is listed in the active file, relaynews tries to store the article
  20048.       in the corresponding directory in the news spool area. If this directory
  20049.       does  not  exist,  it is created.  The article's message id will then be
  20050.       logged to the history file.  Otherwise, relaynews drops the article.
  20051.  
  20052.  
  20053.             If relaynews fails to store an incoming article because a group it
  20054.       has  been  posted to is not listed in your active file, the article will
  20055.       be moved to the junk group.(1) relaynews will also check  for  stale  or
  20056.       misdated  articles  and  reject them. Incoming batches that fail for any
  20057.       other reason are moved to /var/spool/news/in.coming/bad,  and  an  error
  20058.       message is logged.
  20059.  
  20060.  
  20061.  
  20062.  
  20063.  
  20064.                                  - 304 -
  20065.  
  20066.  
  20067.  
  20068.            After  this,  the  article  will be relayed to all other sites that
  20069.       request news from these groups, using the transport specified  for  each
  20070.       particular  site.  To make sure it isn't sent to a site that already has
  20071.       seen it, each destination site is checked against  the  article's  Path:
  20072.       header field, which contains the list of sites the article has traversed
  20073.       so far, written in bang path style.  Only if the destination site's name
  20074.       does not appear in this list will the article be sent to it.
  20075.  
  20076.  
  20077.              C News is commonly used to relay news between UUCP sites, altough
  20078.       it is also possible to use it in a NNTP environment. To deliver news  to
  20079.       a  remote  UUCP site --- either single articles or whole batches --- uux
  20080.       is used to execute the rnews command on the remote site,  and  feed  the
  20081.       article or batch to it on standard input.
  20082.  
  20083.  
  20084.              When  batching  is enabled for a given site, C News does not send
  20085.       any incoming article immediately, but appends its path name to  a  file,
  20086.       usually  out.going/site/togo.   Periodically,  a batcher program is exe-
  20087.       cuted  from  a  crontab entry,(2) which puts the articles in one or more
  20088.       files, optionally compresses them, and sends them to rnews at the remote
  20089.       site.
  20090.  
  20091.  
  20092.            Figure  18.1 shows the news flow through relaynews. Articles may be
  20093.       relayed to the local site (denoted by ME), to some site named  ponderosa
  20094.       via email, and a site named moria, for which batching is enabled.
  20095.  
  20096.  
  20097.  
  20098.  
  20099.  
  20100.  
  20101.  
  20102.  
  20103.       18.2  Installation
  20104.  
  20105.  
  20106.  
  20107.  
  20108.            To  install C News, untar the files into their proper places if you
  20109.       haven't done so yet, and edit  the  configuration  files  listed  below.
  20110.       They  are all located in /usr/lib/news.  Their formats will be described
  20111.       in the following sections.
  20112.  
  20113.       
  20114.  
  20115.       1. There may be a difference between the groups  that  exist
  20116.          at  your  site,  and  those  that your site is willing to
  20117.          receive. For example, the subscription list  may  specify
  20118.          comp.all,  which  means  all  newsgroups  below  the comp
  20119.          hierarchy, but at your site, only a number of comp groups
  20120.          are  listed  in  active.  articles posted to those groups
  20121.          will be moved to junk.
  20122.       2. Note that this should be the crontab of  news,  in  order
  20123.          not to mangle file permissions.
  20124.  
  20125.  
  20126.  
  20127.  
  20128.  
  20129.  
  20130.  
  20131.                                  - 305 -
  20132.  
  20133.  
  20134.  
  20135.  
  20136.  
  20137.  
  20138.  
  20139.                 Figure 22.   News flow through relaynews.
  20140.  
  20141.  
  20142.             sys  You probably have to modify the ME line that  describes  your
  20143.                 system,  although using all/all is always a safe bet. You also
  20144.                 have to add a line for each site you feed news to.
  20145.  
  20146.  
  20147.                      If you are a leaf site, you only need a line  that  sends
  20148.                 all locally generated articles to your feed.  Assume your feed
  20149.                 is moria, then your sys file should look like this:
  20150.  
  20151.  
  20152.                      ME:all/all::
  20153.                      moria/moria.orcnet.org:all/all,!local:f:
  20154.  
  20155.  
  20156.  
  20157.  
  20158.       organization Your organization's name. For example,  ``Virtual  Brewery,
  20159.                 Inc.''.  On your home machine, enter ``private site'', or any-
  20160.                 thing else you like.  Most people  will  not  call  your  site
  20161.                 properly configured if you haven't customized this file.
  20162.  
  20163.  
  20164.       newsgroups
  20165.  
  20166.  
  20167.        mailname Your site's mail name, e.g. vbrew.com.
  20168.  
  20169.  
  20170.          whoami Your site's name for news purposes. Quite often, the UUCP site
  20171.                 name is used, for example vbrew.
  20172.  
  20173.  
  20174.         explist You should probably edit this file to reflect  your  preferred
  20175.                 expiry  times for some special newsgroups. Disk space may play
  20176.                 an important role in it.
  20177.  
  20178.  
  20179.  
  20180.  
  20181.  
  20182.             To create an initial hierarchy of newsgroups, obtain an active and
  20183.       a  newsgroups  file  from  the  site that feeds you, and install them in
  20184.       /usr/lib/news, making sure they are owned by news and  have  a  mode  of
  20185.       644.  Remove all to.* groups from the active file, and add to.mysite and
  20186.       to.feedsite, as well as junk and control. The to.* groups  are  normally
  20187.       used  for  exchanging  ihave/sendme messages, but you should create them
  20188.       regardless of whether you  plan  to  use  ihave/sendme  or  not.   Next,
  20189.  
  20190.  
  20191.  
  20192.  
  20193.  
  20194.  
  20195.  
  20196.  
  20197.                                  - 306 -
  20198.  
  20199.  
  20200.  
  20201.       replace  all  article  numbers  in  the second and third field of active
  20202.       using the following command:
  20203.  
  20204.  
  20205.  
  20206.            # cp active active.old
  20207.            # sed 's/ [0-9]* [0-9]* / 0000000000 00001 /' active.old > active
  20208.            # rm active.old
  20209.  
  20210.  
  20211.  
  20212.  
  20213.            The second command is an invocation of sed(1), one of  my  favorite
  20214.       Un*x  commands.  This  invocation  replaces two strings of digits with a
  20215.       string of zeroes and the string 000001, respectively.
  20216.  
  20217.  
  20218.            Finally, create the news spool  directory  and  the  subdirectories
  20219.       used for incoming and outgoing news:
  20220.  
  20221.  
  20222.  
  20223.            # cd /var/spool
  20224.            # mkdir news news/in.coming news/out.going
  20225.            # chown -R news.news news
  20226.            # chmod -R 755 news
  20227.  
  20228.  
  20229.  
  20230.  
  20231.            If  you're  using  a  later release of C News, you may also have to
  20232.       create the out.master directory in the news spool directory.
  20233.  
  20234.  
  20235.            If you're using newsreaders from a different distribution than  the
  20236.       C News you have running, you may find that some expect the news spool on
  20237.       /usr/spool/news rather  than  in  /var/spool/news.  If  your  newsreader
  20238.       doesn't   seem   to   find   any   articles,   create  a  symbolic  from
  20239.       /usr/spool/news to /var/spool/news.
  20240.  
  20241.  
  20242.            Now, you are ready to receive news. Note that  you  don't  have  to
  20243.       create any directories other than those shown above, because each time C
  20244.       News receives an article from a group for which there's no spool  direc-
  20245.       tory yet, it will create it.
  20246.  
  20247.  
  20248.            In  particular,  this  happens  to  all  groups an article has been
  20249.       crossposted to. So, after a while, you will find your news  spool  clut-
  20250.       tered with directories for newsgroups you have never subscribed to, like
  20251.       alt.lang.teco. You may prevent this  by  either  removing  all  unwanted
  20252.       groups from active, or by regularly running a shell script which removes
  20253.       all  empty  directories  below  /var/spool/news  (except  out.going  and
  20254.       in.coming, of course).
  20255.  
  20256.  
  20257.  
  20258.  
  20259.  
  20260.  
  20261.  
  20262.  
  20263.                                  - 307 -
  20264.  
  20265.  
  20266.  
  20267.  
  20268.  
  20269.  
  20270.              C News needs a user to send error messages and status reports to.
  20271.       By default, this is usenet. If you use the default, you have to  set  up
  20272.       an  alias for it which forwards all of its mail to one or more responsi-
  20273.       ble persons.  (Chapters 15. and 16. explain how to do so for  smail  and
  20274.       sendmail).   You may also override this behavior by setting the environ-
  20275.       ment variable NEWSMASTER to the appropriate name.  You have to do so  in
  20276.       news'  crontab  file, as well as every time you invoke an administrative
  20277.       tool manually, so installing an alias is probably easier.
  20278.  
  20279.  
  20280.             While you're hacking /etc/passwd, make sure that  every  user  has
  20281.       her  real  name  in the pw gecos field of the password file (this is the
  20282.       fourth field). It is a question of Usenet netiquette that  the  sender's
  20283.       real  name  appears  in  the From: field of the article.  Of course, you
  20284.       will want to do so anyway when you use mail.
  20285.  
  20286.  
  20287.       18.3  The sys file
  20288.  
  20289.  
  20290.  
  20291.  
  20292.            The sys file, located in /usr/lib/news, controls which  hierarchies
  20293.       you  receive  and forward to other sites. Although there are maintenance
  20294.       tools named addfeed and delfeed, I think it's better  to  maintain  this
  20295.       file by hand.
  20296.  
  20297.  
  20298.            The sys file contains entries for each site you forward news to, as
  20299.       well as a description of the groups you will  accept.   An  entry  looks
  20300.       like
  20301.  
  20302.  
  20303.            site[/exclusions]:grouplist[/distlist][:flags[:cmds]]
  20304.  
  20305.  
  20306.  
  20307.  
  20308.            Entries may be continued across newlines using a backslash (\).   A
  20309.       hash sign (#) denotes a comment.
  20310.  
  20311.  
  20312.  
  20313.  
  20314.            site This is the name of the site the entry applies to. One usually
  20315.                 chooses the site's UUCP name for this.  There  has  to  be  an
  20316.                 entry  for  your  site in the sys file, too, else you will not
  20317.                 receive any articles yourself.
  20318.  
  20319.  
  20320.                       The special site name ME denotes your site. The ME entry
  20321.  
  20322.  
  20323.  
  20324.  
  20325.  
  20326.  
  20327.  
  20328.  
  20329.                                  - 308 -
  20330.  
  20331.  
  20332.  
  20333.                 defines  all groups you are willing to store locally. Articles
  20334.                 that aren't matched by the ME line will go to the junk  group.
  20335.  
  20336.  
  20337.                        Since  C News checks site against the site names in the
  20338.                 Path: header field, you have to make sure they  really  match.
  20339.                 Some  sites  use  their  fully  qualified  domain name in this
  20340.                 field, or an alias like news.site.domain. To prevent any arti-
  20341.                 cles from being returned to these sites, you have to add these
  20342.                 to the exclusion list, separated by commas.
  20343.  
  20344.  
  20345.                      For the entry applying to site moria, for  instance,  the
  20346.                 site field would contain moria/moria.orcnet.org.
  20347.  
  20348.  
  20349.       grouplist   This  is  a  comma-separated subscription list of groups and
  20350.                 hierarchies for that particular site. A hierarchy may be spec-
  20351.                 ified  by  giving  the hierarchy's prefix (such as comp.os for
  20352.                 all groups whose name starts  with  this  prefix),  optionally
  20353.                 followed by the keyword all (e.g. comp.os.all).
  20354.  
  20355.  
  20356.                      A  hierarchy or group is excluded from forwarding by pre-
  20357.                 ceding it with an exclamation mark. If a newsgroup is  checked
  20358.                 against  the  list, the longest match applies. For example, if
  20359.                 grouplist contains
  20360.  
  20361.  
  20362.                      !comp,comp.os.linux,comp.folklore.computers
  20363.  
  20364.  
  20365.  
  20366.  
  20367.       no groups from the comp hierarchy except comp.folklore.computers and all
  20368.                 groups below comp.os.linux will be fed to that site.
  20369.  
  20370.  
  20371.                      If the site requests to be forwarded all news you receive
  20372.                 yourself, enter all as grouplist.
  20373.  
  20374.  
  20375.        distlist   is offset from the grouplist by a slash, and contains a list
  20376.                 of distributions to be forwarded.  Again, you may exclude cer-
  20377.                 tain distributions by preceding them with an exclamation mark.
  20378.                 All  distributions  are  denoted  by  all.  Omitting  distlist
  20379.                 implies a list of all.
  20380.  
  20381.  
  20382.                      For   example,   you  may  use  a  distribution  list  of
  20383.                 all,!local to prevent news for local use only from being  sent
  20384.                 to remote sites.
  20385.  
  20386.  
  20387.  
  20388.  
  20389.  
  20390.  
  20391.  
  20392.  
  20393.  
  20394.  
  20395.                                  - 309 -
  20396.  
  20397.  
  20398.  
  20399.                      There  are  usually  at  least  two distributions: world,
  20400.                 which is often the default  distribution  used  when  none  is
  20401.                 specified by the user, and local. There may be other distribu-
  20402.                 tions that apply to a certain  region,  state,  country,  etc.
  20403.                 Finally,  there  are  two  distributions  used by C News only;
  20404.                 these are sendme and ihave, and are used for the  sendme/ihave
  20405.                 protocol.
  20406.  
  20407.  
  20408.                      The use of distributions is a subject of debate. For one,
  20409.                 some newsreaders create bogus distributions  by  simply  using
  20410.                 the  top  level  hierarchy,  for  example comp when posting to
  20411.                 comp.os.linux.  Distributions that apply to regions are  often
  20412.                 questionable,  too,  because  news  may travel outside of your
  20413.                 region when sent across the Internet.(3) Distributions  apply-
  20414.                 ing  to  an  organization,  however,  are very meaningful, for
  20415.                 example to prevent confidential information from  leaving  the
  20416.                 company  network.  This  purpose, however, is generally served
  20417.                 better by creating a separate newsgroup or hierarchy.
  20418.  
  20419.  
  20420.           flags
  20421.  
  20422.  
  20423.                      This describes certain parameters for the feed. It may be
  20424.                 empty, or a combination of the following:
  20425.  
  20426.  
  20427.  
  20428.  
  20429.                         F  This flag enables batching.
  20430.  
  20431.  
  20432.                         f   This is almost identical to the F flag, but allows
  20433.                           C News to calculate the  size  of  outgoing  batches
  20434.                           more precisely.
  20435.  
  20436.  
  20437.                         I   This  flag  makes  C  News produce an article list
  20438.                           suitable for use by ihave/sendme. Additional modifi-
  20439.                           cations  to  the  sys  and  the  batchparms file are
  20440.                           required to enable ihave/sendme.
  20441.  
  20442.  
  20443.                         n  This creates batch files for active  NNTP  transfer
  20444.                           clients  like nntpxmit (see chapter 19.).  The batch
  20445.                           files contain the article's filename along with  its
  20446.                           message id.
  20447.  
  20448.  
  20449.  
  20450.       
  20451.  
  20452.       3. It is not uncommon for an article posted in, say Hamburg,
  20453.          to go to Frankfurt via reston.ans.net in the Netherlands,
  20454.          or even via some site in the U.S.
  20455.  
  20456.  
  20457.  
  20458.  
  20459.  
  20460.  
  20461.  
  20462.                                  - 310 -
  20463.  
  20464.  
  20465.  
  20466.                         L This  tells  C News to transmit only articles posted
  20467.                           at your site. This flag may be followed by a decimal
  20468.                           number  n, which makes C News only transfer articles
  20469.                           posted within n hops from your site. C  News  deter-
  20470.                           mines the number of hops from the Path: field.
  20471.  
  20472.  
  20473.                         u This tells C News to batch only articles from unmod-
  20474.                           erated groups.
  20475.  
  20476.  
  20477.                         m This tells C News to batch only articles from moder-
  20478.                           ated groups.
  20479.  
  20480.  
  20481.  
  20482.                      You may use at most one of F, f, I, or n.
  20483.  
  20484.  
  20485.            cmds   This  field contains a command to be executed for each arti-
  20486.                 cle, unless batching is enabled. The article will  be  fed  to
  20487.                 the  command  on  standard input. This should only be used for
  20488.                 very small feeds; otherwise the load on both systems  will  be
  20489.                 too high.
  20490.  
  20491.  
  20492.                      The default command is
  20493.  
  20494.  
  20495.                      uux - -r -z system!rnews
  20496.  
  20497.  
  20498.  
  20499.  
  20500.       which  invokes  rnews  on  the  remote system, feeding it the article on
  20501.                 standard input.
  20502.  
  20503.  
  20504.                      The default search path for commands given in this  field
  20505.                 is /bin:/usr/bin:/usr/lib/news/bin/batch. The latter directory
  20506.                 contains a number of shell scripts whose name starts with via;
  20507.                 they are briefly described later in this chapter.
  20508.  
  20509.  
  20510.                        If batching is enabled using either of the F or f, I or
  20511.                 n flags, C News expects to find a  file  name  in  this  field
  20512.                 rather  than a command. If the file name does not begin with a
  20513.                 slash   (/),   it   is   assumed    to    be    relative    to
  20514.                 /var/spool/news/out.going.  If the field is empty, it defaults
  20515.                 to system/togo.
  20516.  
  20517.  
  20518.  
  20519.  
  20520.  
  20521.  
  20522.  
  20523.  
  20524.  
  20525.  
  20526.  
  20527.  
  20528.                                  - 311 -
  20529.  
  20530.  
  20531.  
  20532.            When setting up C News, you will most probably have to  write  your
  20533.       own  sys  file. To help you with it, we give a sample file for vbrew.com
  20534.       below, from which you might copy what you need.
  20535.  
  20536.  
  20537.  
  20538.            # We take whatever they give us.
  20539.            ME:all/all::
  20540.  
  20541.            # We send everything we receive to moria, except for local and
  20542.            # brewery-related articles. We use batching.
  20543.            moria/moria.orcnet.org:all,!to,to.moria/all,!local,!brewery:f:
  20544.  
  20545.            # We mail comp.risks to jack@ponderosa.uucp
  20546.            ponderosa:comp.risks/all::rmail jack@ponderosa.uucp
  20547.  
  20548.            # swim gets a minor feed
  20549.            swim/swim.twobirds.com:comp.os.linux,rec.humor.oracle/all,!local:f:
  20550.  
  20551.            # Log mail map articles for later processing
  20552.            usenet-maps:comp.mail.maps/all:F:/var/spool/uumaps/work/batch
  20553.  
  20554.  
  20555.  
  20556.  
  20557.  
  20558.  
  20559.  
  20560.       18.4  The active file
  20561.  
  20562.  
  20563.  
  20564.  
  20565.            The  active  file  is located in /usr/lib/news and lists all groups
  20566.       known at your site, and the articles currently online. You  will  rarely
  20567.       have  to  touch it, but we explain it nevertheless for sake of complete-
  20568.       ness.  Entries take the following form:
  20569.  
  20570.  
  20571.            newsgroup high low perm
  20572.  
  20573.  
  20574.  
  20575.  
  20576.            newsgroup is, of course, the group's name.  low and  high  are  the
  20577.       lowest and highest numbers of articles currently available.  If none are
  20578.       available at the moment, low is equal to high+1.
  20579.  
  20580.  
  20581.             At least, that's what the low field is meant to do.  However,  for
  20582.       efficiency  reasons, C News doesn't update this field.  This wouldn't be
  20583.       such a big loss if there weren't some newsreaders  that  depend  on  it.
  20584.       For  instance, trn checks this field to see if it can purge any articles
  20585.       from its thread database.  To update the low field, you  therefore  have
  20586.  
  20587.  
  20588.  
  20589.  
  20590.  
  20591.  
  20592.  
  20593.  
  20594.                                  - 312 -
  20595.  
  20596.  
  20597.  
  20598.       to  run  the  updatemin  command  regularly (or, in earlier version of C
  20599.       News, the upact script).
  20600.  
  20601.  
  20602.            perm is a parameter detailing the access users are granted  to  the
  20603.       group. It takes one of the following values:
  20604.  
  20605.  
  20606.  
  20607.  
  20608.               y Users are allowed to post to this group.
  20609.  
  20610.  
  20611.               n Users  are  not  allowed  to  post to this group. However, the
  20612.                 group may still be read.
  20613.  
  20614.  
  20615.               x This group has been disabled locally. This  happens  sometimes
  20616.                 when  news  admininistrators (or their superiors) take offense
  20617.                 to articles posted to certain groups.
  20618.  
  20619.  
  20620.                      Articles received for this group are not stored  locally,
  20621.                 although they are forwarded to the sites that request them.
  20622.  
  20623.  
  20624.               m This  denotes  a moderated group. When a user tries to post to
  20625.                 this group, an intelligent newsreader will notify her of this,
  20626.                 and send the article to the moderator instead. The moderator's
  20627.                 address is taken from the moderators file in /usr/lib/news.
  20628.  
  20629.  
  20630.       =real-group This marks newsgroup as being  a  local  alias  for  another
  20631.                 group,  namely  real-group.  All  articles posted to newsgroup
  20632.                 will be redirected to it.
  20633.  
  20634.  
  20635.  
  20636.            In C News,  you  will  generally  not  have  to  access  this  file
  20637.       directly.   Groups  may  be  added or deleted locally using addgroup and
  20638.       delgroup (see below in section 18.10).  When groups are added or deleted
  20639.       for  the  whole of Usenet, this is usually done by sending a newgroup or
  20640.       rmgroup control message, respectively. Never send such a  message  your-
  20641.       self!   For  instructions on how to create a newsgroup, read the monthly
  20642.       postings in news.announce.newusers.
  20643.  
  20644.  
  20645.            A file closely related to active is active.times. Whenever a  group
  20646.       is  created,  C News logs a message to this file, containing the name of
  20647.       the group created, the date of creation, whether it was done by  a  new-
  20648.       group  control message or locally, and who did it.  This is for the con-
  20649.       venience of newsreaders who may notify the user of any recently  created
  20650.       groups. It is also used by the NEWGROUPS command of NNTP.
  20651.  
  20652.  
  20653.  
  20654.  
  20655.  
  20656.  
  20657.  
  20658.  
  20659.  
  20660.                                  - 313 -
  20661.  
  20662.  
  20663.  
  20664.  
  20665.  
  20666.  
  20667.       18.5  Article Batching
  20668.  
  20669.  
  20670.  
  20671.  
  20672.            Newsbatches follow a particular format which is the same for Bnews,
  20673.       C News, and INN. Each article is preceded by a line like this:
  20674.  
  20675.  
  20676.            #! rnews count
  20677.  
  20678.  
  20679.  
  20680.  
  20681.       where count is the number of bytes in the article. When  batch  compres-
  20682.       sion  is used, the resulting file is compressed as a whole, and preceded
  20683.       by another line, indicated by the message to be used for unpacking.  The
  20684.       standard compression tool is compress, which is marked by
  20685.  
  20686.  
  20687.            #! cunbatch
  20688.  
  20689.  
  20690.  
  20691.  
  20692.            Sometimes,  when  having  to  send  batches  via mail software that
  20693.       removes the eighth bit from all data, a compressed  batch  may  be  pro-
  20694.       tected using what is called c7-encoding; these batches will be marked by
  20695.       c7unbatch.
  20696.  
  20697.  
  20698.            When a batch is fed to rnews on the  remote  site,  it  checks  for
  20699.       these  markers  and  processes the batch appropriately.  Some sites also
  20700.       use other compression tools, like gzip, and precede their gzipped  files
  20701.       with  zunbatch  instead.  C News does not recognize non-standard headers
  20702.       like these; you have to modify the source to support them.
  20703.  
  20704.  
  20705.               In    C    News,    article    batching    is    performed    by
  20706.       /usr/lib/news/bin/batch/sendbatches, which takes a list of articles from
  20707.       the site/togo file, and puts them into several newsbatches.   It  should
  20708.       be executed once per hour or even more frequently, depending on the vol-
  20709.       ume of traffic.
  20710.  
  20711.  
  20712.            Its  operation  is   controlled   by   the   batchparms   file   in
  20713.       /usr/lib/news.   This  file describes the maximum batch size allowed for
  20714.       each site, the batching and optional compression program to be used, and
  20715.       the  transport  for  delivering  it  to the remote site. You may specify
  20716.       batching parameters on a per-site basis, as well as  a  set  of  default
  20717.       parameters for sites not explicitly mentioned.
  20718.  
  20719.  
  20720.  
  20721.  
  20722.  
  20723.  
  20724.  
  20725.  
  20726.                                  - 314 -
  20727.  
  20728.  
  20729.  
  20730.            To perform batching for a specific site, you invoke it as
  20731.  
  20732.  
  20733.            # su news -c "/usr/lib/news/bin/batch/sendbatches site"
  20734.  
  20735.  
  20736.  
  20737.  
  20738.             When invoked without  arguments,  sendbatches  handles  all  batch
  20739.       queues.  The  interpretation  of  ``all''  depends  on the presence of a
  20740.       default entry in  batchparms.  If  one  is  found,  all  directories  in
  20741.       /var/spool/news/out.going  are checked, otherwise, it cycles through all
  20742.       entries  in  batchparms.   Note  that  sendbatches,  when  scanning  the
  20743.       out.going directory, takes only those directories that contain no dot or
  20744.       at sign (@) as site names.
  20745.  
  20746.  
  20747.            When installing C News, you will most likely find a batchparms file
  20748.       in  your  distribution  which  contains  a  reasonable default entry, so
  20749.       there's a good chance that you wouldn't have to touch the file.  Just in
  20750.       case,  we  describe  its  format nevertheless. Each line consists of six
  20751.       fields, separated by spaces or tabs:
  20752.  
  20753.  
  20754.            site size max batcher muncher transport
  20755.  
  20756.  
  20757.  
  20758.  
  20759.            The meaning of these fields is as follows:
  20760.  
  20761.  
  20762.            site is the name of the site the entry applies to.  The  togo  file
  20763.       for this site must reside in out.going/togo below the news spool. A site
  20764.       name of /default/ denotes the default entry.
  20765.  
  20766.  
  20767.            size is the maximum size of article batches  created  (before  com-
  20768.       pression).  For single articles larger than this, C News makes an excep-
  20769.       tion and puts them in a single batch by themselves.
  20770.  
  20771.  
  20772.            max is the maximum number of  batches  created  and  scheduled  for
  20773.       transfer before batching stalls for this particular site. This is useful
  20774.       in case the remote site should be down for a long time, because it  pre-
  20775.       vents  C  News from cluttering your UUCP spool directories with zillions
  20776.       of newsbatches.
  20777.  
  20778.  
  20779.            C News determines the number of queued batches  using  the  queulen
  20780.       script  in /usr/lib/news/bin. Vince Skahan's newspak release should con-
  20781.       tain a script for BNU-compatible UUCPs. If you use a different flavor of
  20782.       spool  directories,  for  example,  Taylor UUCP, you might have to write
  20783.       your own.(4)
  20784.  
  20785.  
  20786.             The batcher field contains the command used for producing a  batch
  20787.       from  the  list of articles in the togo file. For regular feeds, this is
  20788.       usually  batcher.  For  other  purposes,  alternative  batchers  may  be
  20789.  
  20790.  
  20791.  
  20792.                                  - 315 -
  20793.  
  20794.  
  20795.  
  20796.       provided.  For  instance, the ihave/sendme protocol requires the article
  20797.       list to be turned into ihave  or  sendme  control  messages,  which  are
  20798.       posted  to  the  newsgroup  to.site.   This  is performed by batchih and
  20799.       batchsm.
  20800.  
  20801.  
  20802.             The muncher field specifies  the  command  used  for  compression.
  20803.       Usually,  this is compcun, a script that produces a compressed batch.(5)
  20804.       Alternatively, you might provide a muncher that uses gzip,  say  gzipcun
  20805.       (to  be  clear:  you  have to write it yourself).  You have to make sure
  20806.       that uncompress on the remote site is patched to  recognize  files  com-
  20807.       pressed with gzip.
  20808.  
  20809.  
  20810.            If  the  remote  site  does not have an uncompress command, you may
  20811.       specify nocomp which does not do any compression.
  20812.  
  20813.  
  20814.            The last field, transport, describes the transport to be  used.   A
  20815.       number of standard commands for different transports are available whose
  20816.       names begin with via. sendbatches passes them the destination site  name
  20817.       on  the  command  line.   If  the batchparms entry was not /default/, it
  20818.       derives the site name from the site field by stripping of anything after
  20819.       and  including  the  first  dot  or  slash.  If entry was /default/, the
  20820.       directory names in out.going are used.
  20821.  
  20822.  
  20823.             There are two commands that use uux to execute rnews on the remote
  20824.       system;  viauux and viauuxz. The latter sets the -z flag for (older ver-
  20825.       sions of) uux to keep it from returning success messages for each  arti-
  20826.       cle  delivered.  Another  command, viamail, sends article batches to the
  20827.       user rnews on the remote system via mail. Of course, this requires  that
  20828.       the  remote  system somehow feeds all mail for rnews to their local news
  20829.       system.  For a complete list of these transports,  refer  to  the  news-
  20830.       batch(8) manual page.
  20831.  
  20832.  
  20833.            All  commands  from the last three fields must be located in either
  20834.       of out.going/site or /usr/lib/news/bin/batch.  Most of them are scripts,
  20835.       so  that  you  may easily tailor new tools for your personal needs. They
  20836.       are invoked as a pipe. The list of articles is fed  to  the  batcher  on
  20837.       standard  input,  which  produces the batch on standard output.  This is
  20838.       piped into the muncher, and so on.
  20839.  
  20840.       
  20841.  
  20842.       4. If you  don't  care  about  the  number  of  spool  files
  20843.          (because  you're the only person using your computer, and
  20844.          you don't  write  articles  by  the  megabyte),  you  may
  20845.          replace   the  script's  contents  by  a  simple  exit  0
  20846.          statement.
  20847.       5. As shipped with C News, compcun uses compress with the 12
  20848.          bit option, since this is the  least  common  denominator
  20849.          for  most  sites.  You  may  produce  a  copy  of it, say
  20850.          compcun16,  where  you  use  16  bit   compression.   The
  20851.          improvement is not too impressive, though.
  20852.  
  20853.  
  20854.  
  20855.  
  20856.  
  20857.  
  20858.  
  20859.                                  - 316 -
  20860.  
  20861.  
  20862.  
  20863.            A sample file is given below.
  20864.  
  20865.  
  20866.  
  20867.            # batchparms file for the brewery
  20868.            # site        | size   |max    |batcher  |muncher    |transport
  20869.            #-------------+--------+-------+---------+-----------+-----------
  20870.            /default/       100000  22      batcher   compcun     viauux
  20871.            swim             10000  10      batcher   nocomp      viauux
  20872.  
  20873.  
  20874.  
  20875.  
  20876.  
  20877.  
  20878.  
  20879.       18.6  Expiring News
  20880.  
  20881.  
  20882.  
  20883.  
  20884.            In Bnews, expiring used to be performed by a program called expire,
  20885.       which took a list of newsgroups as arguments, along with a time specifi-
  20886.       cation  after which articles had to be expired.  To have different hier-
  20887.       archies expired at different times, you  had  to  write  a  script  that
  20888.       invoked expire for each of them separately.  C News offers a more conve-
  20889.       nient solution to this: in a file called explist, you may specify  news-
  20890.       groups  and  expiration intervals.  A command called doexpire is usually
  20891.       run once a day from cron, and processes all  groups  according  to  this
  20892.       list.
  20893.  
  20894.  
  20895.              Occasionally, you may want to retain articles from certain groups
  20896.       even after they have been expired; for example, you might want  to  keep
  20897.       programs  posted to comp.sources.unix. This is called archiving. explist
  20898.       permits you to mark groups for archiving.
  20899.  
  20900.  
  20901.            An entry in explist looks like this:
  20902.  
  20903.  
  20904.            grouplist perm times archive
  20905.  
  20906.  
  20907.  
  20908.  
  20909.            grouplist is a comma-separated list  of  newsgroups  to  which  the
  20910.       entry  applies.  Hierarchies  may  be specified by giving the group name
  20911.       prefix, optionally appended with all. For example, for an entry applying
  20912.       to  all  groups  below  comp.os,  you  might  either  enter  comp.os  or
  20913.       comp.os.all in grouplist.
  20914.  
  20915.  
  20916.            When expiring news from a group, the name is  checked  against  all
  20917.  
  20918.  
  20919.  
  20920.  
  20921.  
  20922.  
  20923.  
  20924.  
  20925.                                  - 317 -
  20926.  
  20927.  
  20928.  
  20929.       entries in explist in the order given. The first matching entry applies.
  20930.       For example, to throw away the majority of comp after four days,  except
  20931.       for comp.os.linux.announce which you want to keep for a week, you simply
  20932.       have an entry for the latter, which  specifies  a  seven-day  expiration
  20933.       period, followed by that for comp, which specifies four days.
  20934.  
  20935.  
  20936.            The  perm field details if the entry applies to moderated, unmoder-
  20937.       ated, or any groups. It may take the values m, u,  or  x,  which  denote
  20938.       moderated, unmoderated, or any type.
  20939.  
  20940.  
  20941.            The  third  field,  times,  usually  contains only a single number.
  20942.       This is the number of days after which articles will be expired if  they
  20943.       haven't been assigned an artificial expiration date in an Expires: field
  20944.       in the article header. Note that this is the  number  of  days  counting
  20945.       from its arrival at your site, not the date of posting.
  20946.  
  20947.  
  20948.            The times field may, however, be more complex than that.  It may be
  20949.       a combination of up to three numbers, separated from one  another  by  a
  20950.       dash.  The first denotes the number of days that have to pass before the
  20951.       article is considered a candidate for expiration. It is rarely useful to
  20952.       use  a  value  other  than zero. The second field is the above-mentioned
  20953.       default number of days after which it will be expired. The third is  the
  20954.       number  of  days after which an article will be expired unconditionally,
  20955.       regardless of whether it has an Expires: field or not. If only the  mid-
  20956.       dle  number  is  given,  the other two take default values. These may be
  20957.       specified using the special entry /bounds/, which is described below.
  20958.  
  20959.  
  20960.            The fourth field, archive, denotes whether the newsgroup is  to  be
  20961.       archived,  and  where.   If  no  archiving is intended, a dash should be
  20962.       used.  Otherwise, you either use a full path name (pointing to a  direc-
  20963.       tory), or an at sign (@). The at sign denotes the default archive direc-
  20964.       tory which must then be given to doexpire by using the -a  flag  on  the
  20965.       command  line.  An archive directory should be owned by news. When doex-
  20966.       pire archives an article from, say comp.sources.unix, it  stores  it  in
  20967.       the directory comp/sources/unix below the archive directory, creating it
  20968.       if not existent. The archive directory itself, however, will not be cre-
  20969.       ated.
  20970.  
  20971.  
  20972.            There  are  two  special entries in your explist file that doexpire
  20973.       relies on.  Instead of a list of  newsgroups,  they  have  the  keywords
  20974.       /bounds/  and  /expired/. The /bounds/ entry contains the default values
  20975.       for the three values of the times field described above.
  20976.  
  20977.  
  20978.            The /expired/ field determines how long C  News  will  hold  on  to
  20979.       lines in the history file. This is needed because C News will not remove
  20980.       a line from the history file once the corresponding article(s) have been
  20981.       expired,  but will hold on to it in case a duplicate should arrive after
  20982.       this date. If you are fed by only one site,  you  can  keep  this  value
  20983.  
  20984.  
  20985.  
  20986.  
  20987.  
  20988.  
  20989.  
  20990.  
  20991.                                  - 318 -
  20992.  
  20993.  
  20994.  
  20995.       small.  Otherwise,  a  couple  of  weeks  is advisable on UUCP networks,
  20996.       depending on the delays you experience with articles from these sites.
  20997.  
  20998.  
  20999.            A sample explist file with rather tight expiry intervals is  repro-
  21000.       duced below:
  21001.  
  21002.  
  21003.  
  21004.            # keep history lines for two weeks. Nobody gets more than three months
  21005.            /expired/                       x       14      -
  21006.            /bounds/                        x       0-1-90  -
  21007.  
  21008.            # groups we want to keep longer than the rest
  21009.            comp.os.linux.announce          m       10      -
  21010.            comp.os.linux                   x       5       -
  21011.            alt.folklore.computers          u       10      -
  21012.            rec.humor.oracle                m       10      -
  21013.            soc.feminism                    m       10      -
  21014.  
  21015.            # Archive *.sources groups
  21016.            comp.sources,alt.sources        x       5       @
  21017.  
  21018.            # defaults for tech groups
  21019.            comp,sci                        x       7       -
  21020.  
  21021.            # enough for a long weekend
  21022.            misc,talk                       x       4       -
  21023.  
  21024.            # throw away junk quickly
  21025.            junk                            x       1       -
  21026.  
  21027.            # control messages are of scant interest, too
  21028.            control                         x       1       -
  21029.  
  21030.            # catch-all entry for the rest of it
  21031.            all                             x       2       -
  21032.  
  21033.  
  21034.  
  21035.  
  21036.              With expiring in C News, there are a number of potential troubles
  21037.       looming.  One is that your newsreader might rely on the third  field  of
  21038.       the  active  file,  which  contains the number of the lowest article on-
  21039.       line.  When expiring articles, C News does not update this field. If you
  21040.       need (or want) to have this field represent the real situation, you need
  21041.       to run a program called updatemiin after each run of doexpire.(6)
  21042.  
  21043.  
  21044.              Second, C News does not expire by scanning the newsgroup's direc-
  21045.       tory, but simply checks the history file  if  the  article  is  due  for
  21046.  
  21047.       
  21048.  
  21049.       6. In older versions of C News, this was done  by  a  script
  21050.          called upact.
  21051.  
  21052.  
  21053.  
  21054.  
  21055.  
  21056.  
  21057.  
  21058.                                  - 319 -
  21059.  
  21060.  
  21061.  
  21062.       expiration.(7)  If  your history file somehow gets out of sync, articles
  21063.       may be around on your disk forever, because C News has literally forgot-
  21064.       ten them.(8)  You  can  repair  this  using  the  addmissing  script  in
  21065.       /usr/lib/news/bin/maint,  which will add missing articles to the history
  21066.       file, or mkhistory, which re-builds the entire file from scratch.  Don't
  21067.       forget  to  become news before invoking it, else you will wind up with a
  21068.       history file unreadable by C News.
  21069.  
  21070.  
  21071.  
  21072.  
  21073.  
  21074.       18.7  Miscellaneous Files
  21075.  
  21076.       There are a number of files that control C News' behavior, but  are  not
  21077.       essential  to  its  functioning. All of them reside in /usr/lib/news. We
  21078.       will describe them briefly.
  21079.  
  21080.  
  21081.  
  21082.  
  21083.       newsgroups  This is a companion file of active which contains a list  of
  21084.                 newsgroup names, along with a one-line description of its main
  21085.                 topic.   This  file  is  automatically  updated  when  C  News
  21086.                 receives a checknews control message (see section 18.8).
  21087.  
  21088.  
  21089.       localgroups If  you  have a number of local groups that you don't want C
  21090.                 News to complain about every time you receive a checknews mes-
  21091.                 sage, put their names and descriptions in this file, just like
  21092.                 they would appear in newsgroups.
  21093.  
  21094.  
  21095.       mailpaths  This file contains the moderator's address for each moderated
  21096.                 group. Each line contains the group name, followed by the mod-
  21097.                 erator's email address (offset by a tab).
  21098.  
  21099.  
  21100.                      Two special entries are provided as  default.  These  are
  21101.                 backbone  and internet. Both provide --- in bang-path notation
  21102.                 --- the path to the nearest backbone site, and the  site  that
  21103.                 understands  RFC 822-style addresses (user@host).  The default
  21104.                 entries are
  21105.  
  21106.  
  21107.                      internet      backbone
  21108.  
  21109.  
  21110.  
  21111.       
  21112.  
  21113.       7. The article's date of arrival is kept in the middle field
  21114.          of the history line, given in seconds  since  January  1,
  21115.          1970.
  21116.       8. I  don't  know why this happens, but for me, it does from
  21117.          time to time.
  21118.  
  21119.  
  21120.  
  21121.  
  21122.  
  21123.  
  21124.  
  21125.                                  - 320 -
  21126.  
  21127.  
  21128.  
  21129.                      You will not have to change the  internet  entry  if  you
  21130.                 have  smail or sendmail installed, because they understand RFC
  21131.                 822-addressing.
  21132.  
  21133.  
  21134.                      The backbone entry is used whenever a  user  posts  to  a
  21135.                 moderated  group whose moderator is not listed explicitly.  If
  21136.                 the newsgroup's name is alt.sewer, and the backbone entry con-
  21137.                 tains path!%s, C News will mail the article to path!alt-sewer,
  21138.                 hoping that the backbone machine is able to forward the  arti-
  21139.                 cle. To find out which path to use, ask the news admins at the
  21140.                 site that feeds you.  As a  last  resort,  you  can  also  use
  21141.                 uunet.uu.net!%s.
  21142.  
  21143.  
  21144.       distributions   This file is not really a C News file, but it is used by
  21145.                 some newsreaders, and nntpd. It contains the list of distribu-
  21146.                 tions  recognized  by  your  site,  and  a  description of its
  21147.                 (intended) effect. For example, Virtual Brewery has  the  fol-
  21148.                 lowing file:
  21149.  
  21150.  
  21151.                      world               everywhere in the world
  21152.                      local               Only local to this site
  21153.                      nl                      Netherlands only
  21154.                      mugnet             MUGNET only
  21155.                      fr                      France only
  21156.                      de                      Germany only
  21157.                      brewery            Virtual Brewery only
  21158.  
  21159.  
  21160.  
  21161.  
  21162.             log  This file contains a log of all  C  News  activities.  It  is
  21163.                 culled  regularly by running newsdaily; copies of the old log-
  21164.                 files are kept in log.o, log.oo, etc.
  21165.  
  21166.  
  21167.          errlog This is a log of all error messages created by C  News.  These
  21168.                 do  not  include articles junked due to wrong group, etc. This
  21169.                 file is mailed to the newsmaster (usenet by default) automati-
  21170.                 cally by newsdaily if it is found to be non-empty.
  21171.  
  21172.  
  21173.                      errlog  is  cleared  by newsdaily. Old copies are kept in
  21174.                 errlog.o and companions.
  21175.  
  21176.  
  21177.        batchlog This logs all runs of sendbatches.  It  is  usually  of  scant
  21178.                 interest only. It is also attended by newsdaily.
  21179.  
  21180.  
  21181.       watchtime This is an empty file created each time newswatch is run.
  21182.  
  21183.  
  21184.  
  21185.  
  21186.  
  21187.  
  21188.  
  21189.  
  21190.  
  21191.                                  - 321 -
  21192.  
  21193.  
  21194.  
  21195.       18.8  Control Messages
  21196.  
  21197.  
  21198.  
  21199.  
  21200.            The Usenet news protocol knows a special category of articles which
  21201.       evoke certain responses or actions by the news system. These are  called
  21202.       control  messages.  They  are  recognized  by the presence of a Control:
  21203.       field in the article header, which contains  the  name  of  the  control
  21204.       operation to be performed. There are several types of them, all of which
  21205.       are handled by shell scripts located in /usr/lib/news/ctl.
  21206.  
  21207.  
  21208.            Most of these will perform their action automatically at  the  time
  21209.       the  article  is  processed by C News, without notifying the newsmaster.
  21210.       By  default,  only  checkgroups  messages  will   be   handed   to   the
  21211.       newsmaster,(9) but you may change this by editing the scripts.
  21212.  
  21213.  
  21214.       18.8.1  The cancel Message
  21215.  
  21216.  
  21217.  
  21218.  
  21219.            The most widely known message is cancel, with which a user may can-
  21220.       cel an article sent by her earlier. This effectively removes the article
  21221.       from the spool directories, if it exists. The  cancel  message  is  for-
  21222.       warded  to all sites that receive news from the groups affected, regard-
  21223.       less of whether the article has been seen already or  not.  This  is  to
  21224.       take  into  account  the  possibility that the original article has been
  21225.       delayed over the cancellation message. Some news systems allow users  to
  21226.       cancel other person's messages; this is of course a definite no-no.
  21227.  
  21228.  
  21229.       18.8.2  newgroup and rmgroup
  21230.  
  21231.  
  21232.  
  21233.  
  21234.            Two messages dealing with creation or removal of newsgroups are the
  21235.       newgroup and rmgroup message. Newsgroups below the ``usual'' hierarchies
  21236.       may  be  created  only after a discussion and voting has been held among
  21237.       Usenet readers. The rules applying to the alt hierarchy allow for  some-
  21238.       thing  close to anarchy.  For more information, see the regular postings
  21239.       in news.announce.newusers and  news.announce.newgroups.   Never  send  a
  21240.       newgroup or rmgroup message yourself unless you definitely know that you
  21241.       are allowed to.
  21242.  
  21243.  
  21244.  
  21245.       
  21246.  
  21247.       9. There's  a  funny typo in RFC 1036 (p.12): ``Implementors
  21248.          and administrators may choose to allow  control  messages
  21249.          to  be  carried  out  automatically, or to queue them for
  21250.          annual processing.''
  21251.  
  21252.  
  21253.  
  21254.  
  21255.  
  21256.  
  21257.  
  21258.                                  - 322 -
  21259.  
  21260.  
  21261.  
  21262.       18.8.3  The checkgroups Message
  21263.  
  21264.  
  21265.  
  21266.  
  21267.            checkgroups messages are sent by news administrators  to  make  all
  21268.       sites within a network synchronize their active files with the realities
  21269.       of Usenet. For example, commercial Internet service providers might send
  21270.       out such a message to their customers' sites.  Once a month, the ``offi-
  21271.       cial'' checkgroups message  for  the  major  hierarchies  is  posted  to
  21272.       comp.announce.newgroups  by  its moderator.  However, it is posted as an
  21273.       ordinary article, not as a control message. To perform  the  checkgroups
  21274.       operation,  save  this  article to a file, say /tmp/check, remove every-
  21275.       thing up to the beginning of the control message itself, and feed it  to
  21276.       the checkgroups script using the following command:
  21277.  
  21278.  
  21279.            #   su   news  -c  "/usr/lib/news/bin/ctl/checkgroups"  <
  21280.            /tmp/check
  21281.  
  21282.  
  21283.  
  21284.  
  21285.            This  will update your newsgroups file, adding the groups listed in
  21286.       localgroups. The old newsgroups file will be  moved  to  newsgroups.bac.
  21287.       Note  that  posting  the message locally will rarely work, because inews
  21288.       refuses to accept that large an article.
  21289.  
  21290.  
  21291.            If C News finds mismatches between the  checkgroups  list  and  the
  21292.       active  file,  it  will produce a list of commands that would bring your
  21293.       site up to date, and mail it to the news administrator. The output typi-
  21294.       cally looks like this:
  21295.  
  21296.  
  21297.  
  21298.  
  21299.  
  21300.  
  21301.  
  21302.  
  21303.  
  21304.  
  21305.  
  21306.  
  21307.  
  21308.  
  21309.  
  21310.  
  21311.  
  21312.  
  21313.  
  21314.  
  21315.  
  21316.  
  21317.  
  21318.  
  21319.  
  21320.  
  21321.  
  21322.  
  21323.  
  21324.                                  - 323 -
  21325.  
  21326.  
  21327.  
  21328.            From news Sun Jan 30 16:18:11 1994
  21329.            Date: Sun, 30 Jan 94 16:18 MET
  21330.            From: news (News Subsystem)
  21331.            To: usenet
  21332.            Subject: Problems with your active file
  21333.  
  21334.            The following newsgroups are not valid and should be removed.
  21335.                    alt.ascii-art
  21336.                    bionet.molbio.gene-org
  21337.                    comp.windows.x.intrisics
  21338.                    de.answers
  21339.  
  21340.            You can do this by executing the commands:
  21341.                     /usr/lib/news/bin/maint/delgroup alt.ascii-art
  21342.                     /usr/lib/news/bin/maint/delgroup bionet.molbio.gene-org
  21343.                     /usr/lib/news/bin/maint/delgroup comp.windows.x.intrisics
  21344.                     /usr/lib/news/bin/maint/delgroup de.answers
  21345.  
  21346.            The following newsgroups were missing.
  21347.                    comp.binaries.cbm
  21348.                    comp.databases.rdb
  21349.                    comp.os.geos
  21350.                    comp.os.qnx
  21351.                    comp.unix.user-friendly
  21352.                    misc.legal.moderated
  21353.                    news.newsites
  21354.                    soc.culture.scientists
  21355.                    talk.politics.crypto
  21356.                    talk.politics.tibet
  21357.  
  21358.  
  21359.  
  21360.  
  21361.  
  21362.            When  you  receive a message like this from your news system, don't
  21363.       believe it blindly. Depending on who sent the  checkgroups  message,  it
  21364.       may lack a few groups or even entire hierarchies; so you should be care-
  21365.       ful about removing any groups. If you find groups are listed as  missing
  21366.       that  you  want  to  carry  at your site, you have to add them using the
  21367.       addgroup script. Save the list of missing groups to a file and  feed  it
  21368.       to the following little script:
  21369.  
  21370.  
  21371.  
  21372.            #!/bin/sh
  21373.            cd /usr/lib/news
  21374.  
  21375.            while read group; do
  21376.                if grep -si "^$group[[:space:]].*moderated" newsgroup; then
  21377.                    mod=m
  21378.                else
  21379.                    mod=y
  21380.                fi
  21381.                /usr/lib/news/bin/maint/addgroup $group $mod
  21382.  
  21383.  
  21384.  
  21385.  
  21386.  
  21387.  
  21388.  
  21389.  
  21390.                                  - 324 -
  21391.  
  21392.  
  21393.  
  21394.            done
  21395.  
  21396.  
  21397.  
  21398.  
  21399.       18.8.4  sendsys, version, and senduuname
  21400.  
  21401.  
  21402.  
  21403.  
  21404.            Finally,  there  are  three  messages  that may be used to find out
  21405.       about the network's topology. These are sendsys,  version,  and  senduu-
  21406.       name. They cause C News to return to the sender the sys file, a software
  21407.       version string, and the output of uuname(1),  respectively.  C  News  is
  21408.       very  laconic  about  version  messages;  it returns a simple, unadorned
  21409.       ``C''.
  21410.  
  21411.  
  21412.            Again, you should never issue such a message, unless you have  made
  21413.       sure  that it cannot leave a your (regional) network. Replies to sendsys
  21414.       messages can quickly bring down a UUCP network.(10)
  21415.  
  21416.  
  21417.       18.9  C News in an NFS Environment
  21418.  
  21419.  
  21420.  
  21421.  
  21422.            A simple way to distribute news within a local network is  to  keep
  21423.       all news on a central host, and export the relevant directories via NFS,
  21424.       so that newsreaders may scan the articles directly.   The  advantage  of
  21425.       this  method  over  NNTP is that the overhead involved in retrieving and
  21426.       threading articles is significantly lower. NNTP, on the other hand, wins
  21427.       in a heterogeneous network where equipment varies widely among hosts, or
  21428.       where users don't have equivalent accounts on the server machine.
  21429.  
  21430.  
  21431.            When using NFS, articles posted on a local host  have  to  be  for-
  21432.       warded  to  the  central  machine, because accessing adminstrative files
  21433.       might otherwise expose the system  to  race-conditions  that  leave  the
  21434.       files inconsistent. Also, you might want to protect your news spool area
  21435.       by exporting it read-only, which  requires  forwarding  to  the  central
  21436.       machine, too.
  21437.  
  21438.  
  21439.            C  News  handles this transparently. When you post an article, your
  21440.       newsreader usually invokes inews to inject the  article  into  the  news
  21441.       system.  This  command runs a number of checks on the article, completes
  21442.       the header, and checks the file server in /usr/lib/news.  If  this  file
  21443.       exists  and  contains  a  hostname different from the local host's name,
  21444.       inews is invoked on that server host via rsh.  Since  the  inews  script
  21445.       uses a number of binary commands and support files from C News, you have
  21446.  
  21447.       
  21448.  
  21449.       10.I wouldn't try this on the Internet, either.
  21450.  
  21451.  
  21452.  
  21453.  
  21454.  
  21455.  
  21456.  
  21457.                                  - 325 -
  21458.  
  21459.  
  21460.  
  21461.       to either have C News installed locally, or mount the news software from
  21462.       the server.
  21463.  
  21464.  
  21465.            For  the  rsh  invocation  to work properly, each user must have an
  21466.       equivalent account on the server system, i.e. one to which she  can  log
  21467.       in without being asked for a password.
  21468.  
  21469.  
  21470.            Make  sure  that the hostname given in server literally matches the
  21471.       output of the hostname(1) command on the server  machine,  else  C  News
  21472.       will loop forever when trying to deliver the article.
  21473.  
  21474.  
  21475.       18.10  Maintenance Tools and Tasks
  21476.  
  21477.       Despite  the  complexity  of  C News, a news administrator's life can be
  21478.       fairly easy, because C News provides you with a wide variety of  mainte-
  21479.       nance  tools.  Some of these are intended to be run regularly from cron,
  21480.       like newsdaily.  Using these scripts  reduces  daily  care  and  feeding
  21481.       requirements of your C News installation greatly.
  21482.  
  21483.  
  21484.            Unless   stated   otherwise,   these   commands   are   located  in
  21485.       /usr/lib/news/bin/maint.  Note that you must  become  user  news  before
  21486.       invoking  these  commands.  Running  them as super-user may render these
  21487.       files inaccessible to C News.
  21488.  
  21489.  
  21490.  
  21491.  
  21492.       newsdaily The name already says it: runs this once  a  day.   It  is  an
  21493.                 important  script that helps you keep log files small, retain-
  21494.                 ing copies of each from the last three runs.  It also tries to
  21495.                 sense  any  anomalies,  like stale batches in the incoming and
  21496.                 outgoing directories, postings to unkown  or  moderated  news-
  21497.                 groups,  etc.   Resulting error messages will be mailed to the
  21498.                 newsmaster.
  21499.  
  21500.  
  21501.       newswatch This is a script that should be  run  regularly  to  look  for
  21502.                 anomalies  in  the  news  system,  once  an  hour or so. It is
  21503.                 intended to detect problems that will have immediate effect on
  21504.                 the  operability of your news system and mail a trouble report
  21505.                 to the newsmaster.  Things checked include  stale  lock  files
  21506.                 that  don't  get  removed,  unattended input batches, and disk
  21507.                 space shortage.
  21508.  
  21509.  
  21510.        addgroup Adds a group to your site locally. The proper invocation is
  21511.  
  21512.  
  21513.  
  21514.  
  21515.  
  21516.  
  21517.  
  21518.  
  21519.  
  21520.  
  21521.  
  21522.  
  21523.                                  - 326 -
  21524.  
  21525.  
  21526.  
  21527.                      addgroup groupname y|n|m|=realgroup
  21528.  
  21529.  
  21530.  
  21531.  
  21532.                      The  second  argument has the same meaning as the flag in
  21533.                 the active file, meaning that anyone may  post  to  the  group
  21534.                 (y),  that  no-one  may post (n), that it is moderated (m), or
  21535.                 that it is an alias for another group (=realgroup).
  21536.  
  21537.  
  21538.                      You might also want to use addgroup when the first  arti-
  21539.                 cles in a newly created group arrive earlier than the newgroup
  21540.                 control message that is intended to create it.
  21541.  
  21542.  
  21543.        delgroup Allows you to delete a group locally. Invoke it as
  21544.  
  21545.  
  21546.                      delgroup groupname
  21547.  
  21548.  
  21549.  
  21550.  
  21551.                      You still have to delete the articles that remain in  the
  21552.                 newsgroup's spool directory. Alternatively, you might leave it
  21553.                 to the natural course of events (a.k.a. expire) to  make  them
  21554.                 go away.
  21555.  
  21556.  
  21557.       addmissing Adds  missing  articles  to the history file. Run this script
  21558.                 when there are articles that seem to hang around forever.(11)
  21559.  
  21560.  
  21561.        newsboot This  script should be run at system boot time. It removes any
  21562.                 lock files left over when news processes were killed at  shut-
  21563.                 down,  and closes and executes any batches left over from NNTP
  21564.                 connections that were terminated when shutting down  the  sys-
  21565.                 tem.
  21566.  
  21567.  
  21568.       newsrunning This  resides in /usr/lib/news/bin/input, and may be used to
  21569.                 disable unbatching of incoming news, for instance during  work
  21570.                 hours. You may turn off unbatching by invoking
  21571.  
  21572.  
  21573.                      /usr/lib/news/bin/input/newsrunning off
  21574.  
  21575.  
  21576.  
  21577.  
  21578.  
  21579.       
  21580.  
  21581.       11.Ever wondered how to get rid of that ``Help! I can't  get
  21582.          X11 to work with 0.97.2!!!'' article?
  21583.  
  21584.  
  21585.  
  21586.  
  21587.  
  21588.  
  21589.  
  21590.                                  - 327 -
  21591.  
  21592.  
  21593.  
  21594.                      It is turned on by using on instead of off.
  21595.  
  21596.  
  21597.  
  21598.  
  21599.  
  21600.  
  21601.  
  21602.  
  21603.  
  21604.  
  21605.  
  21606.  
  21607.  
  21608.  
  21609.  
  21610.  
  21611.  
  21612.  
  21613.  
  21614.  
  21615.  
  21616.  
  21617.  
  21618.  
  21619.  
  21620.  
  21621.  
  21622.  
  21623.  
  21624.  
  21625.  
  21626.  
  21627.  
  21628.  
  21629.  
  21630.  
  21631.  
  21632.  
  21633.  
  21634.  
  21635.  
  21636.  
  21637.  
  21638.  
  21639.  
  21640.  
  21641.  
  21642.  
  21643.  
  21644.  
  21645.  
  21646.  
  21647.  
  21648.  
  21649.  
  21650.  
  21651.  
  21652.  
  21653.  
  21654.  
  21655.  
  21656.                                  - 328 -
  21657.  
  21658.  
  21659.  
  21660.       19.  A Description of NNTP
  21661.  
  21662.  
  21663.  
  21664.  
  21665.       19.1  Introduction
  21666.  
  21667.       Due to the different network transport used, NNTP provides for a  vastly
  21668.       different approach to news exchange from C news.  NNTP stands for ``Net-
  21669.       work News Transfer Protocol'', and is not a particular software package,
  21670.       but an Internet Standard.(1) It is based on a stream-oriented connection
  21671.       -- usually over TCP -- between a client anywhere in the network,  and  a
  21672.       server  on a host that keeps netnews on disk storage. The stream connec-
  21673.       tion allows the client and server  to  interactively  negotiate  article
  21674.       transfer  with  nearly  no  turnaround delay, thus keeping the number of
  21675.       duplicate articles low.  Together  with  the  Internet's  high  transfer
  21676.       rates, this adds up to a news transport that surpasses the original UUCP
  21677.       networks by far. While some years ago it was not uncommon for an article
  21678.       to  take  two  weeks  or  more  before  it arrived in the last corner of
  21679.       Usenet, this is now often less than two days; on the Internet itself, it
  21680.       is even within the range of minutes.
  21681.  
  21682.  
  21683.            Various commands allow clients to retrieve, send and post articles.
  21684.       The difference between sending  and  posting  is  that  the  latter  may
  21685.       involve   articles   with   incomplete  header  information.(2)  Article
  21686.       retrieval may be used by news transfer clients as well  as  newsreaders.
  21687.       This  makes  NNTP  an  excellent  tool for providing news access to many
  21688.       clients on a local network without going through  the  contortions  that
  21689.       are necessary when using NFS.
  21690.  
  21691.  
  21692.              NNTP also provides for an active and a passive way of news trans-
  21693.       fer, colloquially called ``pushing'' and ``pulling''. Pushing  is  basi-
  21694.       cally the same as the C news ihave/sendme protocol. The client offers an
  21695.       article to the server through the ``IHAVE <varmsgid>'' command, and  the
  21696.       server returns a response code that indicates whether it already has the
  21697.       article, or if it wants it. If so, the client sends the article,  termi-
  21698.       nated by a single dot on a separate line.
  21699.  
  21700.  
  21701.            Pushing  news  has  the  single disadvantage that it places a heavy
  21702.       load on the server system, since it has to search its  history  database
  21703.       for every single article.
  21704.  
  21705.  
  21706.            The  opposite  technique  is  pulling  news,  in  which  the client
  21707.       requests a list of all (available)  articles  from  a  group  that  have
  21708.       arrived  after  a specified date. This query is performed by the NEWNEWS
  21709.       
  21710.  
  21711.       1. Formally specified in RFC 977.
  21712.       2. When posting an article over NNTP, the server always adds
  21713.          at least one header field, which  is  Nntp-Posting-Host:.
  21714.          It contains the client's host name.
  21715.  
  21716.  
  21717.  
  21718.  
  21719.  
  21720.  
  21721.  
  21722.                                  - 329 -
  21723.  
  21724.  
  21725.  
  21726.       command. From the returned list of message ids, the client selects those
  21727.       articles  it  does  not  yet have, using the ARTICLE command for each of
  21728.       them in turn.
  21729.  
  21730.  
  21731.            The problem with pulling news is that it needs tight control by the
  21732.       server  over  which  groups  and  distributions  it  allows  a client to
  21733.       request. For example, it has to make sure that no confidential  material
  21734.       from newsgroups local to the site are sent to unauthorized clients.
  21735.  
  21736.  
  21737.            There  are  also  a  number of convenience commands for newsreaders
  21738.       that permit them to retrieve the article header and body separately,  or
  21739.       even  single  header  lines from a range of articles. This lets you keep
  21740.       all news on a central host, with all users  on  the  (presumably  local)
  21741.       network  using  NNTP-based client programs for reading and posting. This
  21742.       is an alternative to exporting the news directories  via  NFS  which  is
  21743.       described in chapter 18..
  21744.  
  21745.  
  21746.              An overall problem of NNTP is that it allows the knowledgeable to
  21747.       insert articles into the news stream with  false  sender  specification.
  21748.       This is called news faking.(3) An extension to NNTP allows to require  a
  21749.       user authentication for certain commands.
  21750.  
  21751.  
  21752.              There  are  a  number of NNTP packages available. One of the more
  21753.       widely known is the NNTP daemon, also known as the reference implementa-
  21754.       tion.   Originally,  it  was  written by Stan Barber and Phil Lapsley to
  21755.       illustrate  the  details  of  RFC  977.   Its  most  recent  version  is
  21756.       nntpd-1.5.11,  which  will  be  described below.  You may either get the
  21757.       sources and compile it yourself, or use the nntpd from Fred van Kempen's
  21758.       net-std  binary package.  No ready-to-go binaries of nntpd are provided,
  21759.       because of various site-specific values that must be compiled in.
  21760.  
  21761.  
  21762.            The nntpd package consists of a server and two clients for  pulling
  21763.       and  pushing  news,  respectively, as well as an inews replacement. They
  21764.       live in a Bnews environment, but with a little tweaking,  they  will  be
  21765.       happy  with  C news, too.  However if you plan to use NNTP for more than
  21766.       offering newsreaders access to your news server, the reference implemen-
  21767.       tation is not really an option.  We will therefore discuss only the NNTP
  21768.       daemon contained in the nntpd package, and leave  out  the  client  pro-
  21769.       grams.
  21770.  
  21771.  
  21772.              There  is  also  a  package  called ``InterNet News'', or INN for
  21773.       short, that was written by Rich Salz.  It provides both NNTP  and  UUCP-
  21774.       based news transport, and is more suitable for large news hubs.  When it
  21775.       comes to news transport over NNTP, it is definitely better  than  nntpd.
  21776.       INN is currently at version inn-1.4sec.  There is a kit for building INN
  21777.  
  21778.       
  21779.  
  21780.       3. The  same  problem  exists  with  SMTP,  the  Simple Mail
  21781.          Transfer Protocol.
  21782.  
  21783.  
  21784.  
  21785.  
  21786.  
  21787.  
  21788.  
  21789.                                  - 330 -
  21790.  
  21791.  
  21792.  
  21793.       on a Linux machine  from  Arjan  de  Vet;  it  is  available  from  sun-
  21794.       site.unc.edu  in  the system/Mail directory.  If you want to set up INN,
  21795.       please refer to the documentation that comes along with the  source,  as
  21796.       well as the INN FAQ posted regularly to news.software.b.
  21797.  
  21798.  
  21799.       19.2  Installing the NNTP server
  21800.  
  21801.       The  NNTP  server  is  called  nntpd,  and  may be compiled in two ways,
  21802.       depending on the expected load on the news system.  There  are  no  com-
  21803.       piled  versions  available,  because of some site-specific defaults that
  21804.       are hard-coded into the executable.  All configuration is  done  through
  21805.       macro definines in common/conf.h.
  21806.  
  21807.  
  21808.            nntpd  may  be  configured  as  either  a standalone server that is
  21809.       started at system boot time from rc.inet2, or a daemon managed by inetd.
  21810.       In   the   latter   case  you  have  to  have  the  following  entry  in
  21811.       /etc/inetd.conf:
  21812.  
  21813.  
  21814.  
  21815.            nntp    stream  tcp nowait      news    /usr/etc/in.nntpd    nntpd
  21816.  
  21817.  
  21818.  
  21819.  
  21820.            If  you configure nntpd as standalone, make sure that any such line
  21821.       in inetd.conf is commented out. In either case, you have  to  make  sure
  21822.       there's the following line in /etc/services:
  21823.  
  21824.  
  21825.  
  21826.            nntp    119/tcp   readnews untp    # Network News Transfer Protocol
  21827.  
  21828.  
  21829.  
  21830.  
  21831.            To temporarily store any incoming articles, etc, nntpd also needs a
  21832.       .tmp directory in your news spool. You should create it using
  21833.  
  21834.  
  21835.            # mkdir /var/spool/news/.tmp
  21836.            # chown news.news /var/spool/news/.tmp
  21837.  
  21838.  
  21839.  
  21840.  
  21841.       19.3  Restricting NNTP Access
  21842.  
  21843.  
  21844.  
  21845.  
  21846.            Access to NNTP resources is governed by  the  file  nntp access  in
  21847.  
  21848.  
  21849.  
  21850.  
  21851.  
  21852.  
  21853.  
  21854.  
  21855.                                  - 331 -
  21856.  
  21857.  
  21858.  
  21859.       /usr/lib/news.  Lines  in the file describe the access rights granted to
  21860.       foreign hosts.  Each line has the following format:
  21861.  
  21862.  
  21863.            site   read|xfer|both|no    post|no      [!exceptgroups]
  21864.  
  21865.  
  21866.  
  21867.  
  21868.            If a client connects to the NNTP port, nntpd attempts to obtain the
  21869.       host's fully qualified domain  name  from  its  IP  address  by  reverse
  21870.       lookup.   The  client's  hostname and IP address are checked against the
  21871.       site field of each entry in the order in which they appear in the  file.
  21872.       Matches  may be either partial or exact. If an entry matches exactly, it
  21873.       applies; if the match is partial, it only applies if there is  no  other
  21874.       match following which is at least as good.  site may be specified in one
  21875.       of the following ways:
  21876.  
  21877.  
  21878.  
  21879.  
  21880.        hostname This is a fully qualified domain  name  of  a  host.  If  this
  21881.                 matches  the  client's canonical hostname literally, the entry
  21882.                 applies, and all following entries are ignored.
  21883.  
  21884.  
  21885.       IP address This is an IP  address  in  dotted  quad  notation.   If  the
  21886.                 client's  IP  address matches this, the entry applies, and all
  21887.                 following entries are ignored.
  21888.  
  21889.  
  21890.       domain name This is  a  domain  name,  specified  as  *.domain.  If  the
  21891.                 client's  hostname matches the domain name, the entry matches.
  21892.  
  21893.  
  21894.       network name This  is  the  name  of   a   network   as   specified   in
  21895.                 /etc/networks.   If  the  network  number  of  the client's IP
  21896.                 address matches the network number associated with the network
  21897.                 name, the entry matches.
  21898.  
  21899.  
  21900.         default The default matches any client.
  21901.  
  21902.  
  21903.  
  21904.  
  21905.  
  21906.            Entries  with a more general site specification should be specified
  21907.       earlier, because any matches by these will be overridden by later,  more
  21908.       exact matches.
  21909.  
  21910.  
  21911.            The  second  and  third field describe the access rights granted to
  21912.       the client. The second details  the  permissions  to  retrieve  news  by
  21913.  
  21914.  
  21915.  
  21916.  
  21917.  
  21918.  
  21919.  
  21920.  
  21921.                                  - 332 -
  21922.  
  21923.  
  21924.  
  21925.       pulling  (read),  and  transmit news by pushing (xfer).  A value of both
  21926.       enables both, no denies access altogether. The third  field  grants  the
  21927.       client the right to post articles, that is, deliver articles with incom-
  21928.       plete header information which is completed by the  news  software.   If
  21929.       the second field contains no, the third field is ignored.
  21930.  
  21931.  
  21932.            The  fourth  field is optional, and contains a comma-separated list
  21933.       of groups the client is denied access to.
  21934.  
  21935.  
  21936.            A sample nntp access file is shown below:
  21937.  
  21938.  
  21939.  
  21940.            #
  21941.            # by default, anyone may transfer news, but not read or post
  21942.            default                 xfer            no
  21943.            #
  21944.            # public.vbrew.com offers public access via modem, we allow
  21945.            # them to read and post to any but the local.* groups
  21946.            public.vbrew.com        read            post    !local
  21947.            #
  21948.            # all other hosts at the brewery may read and post
  21949.            *.vbrew.com             read            post
  21950.  
  21951.  
  21952.  
  21953.  
  21954.       19.4  NNTP Authorization
  21955.  
  21956.  
  21957.  
  21958.  
  21959.            When  capitalizing  the  access  tokens  like  xfer  or read in the
  21960.       nntp acces file, nntpd requires the authorization from  the  client  for
  21961.       the respective operations. For instance, when specifying a permission of
  21962.       Xfer or XFER, nntpd will not let the client transfer  articles  to  your
  21963.       site unless it passes authorization.
  21964.  
  21965.  
  21966.            The  authorization  procedure is implemented by means of a new NNTP
  21967.       command named AUTHINFO. Using this command, the client transmits a  user
  21968.       name  and  a  password  to the NNTP server.  nntpd will validate them by
  21969.       checking them against the /etc/passwd database, and verify that the user
  21970.       belongs to the nntp group.
  21971.  
  21972.  
  21973.            The current implementation of NNTP authorization is only experimen-
  21974.       tal, and has therefore not been implemented very portably.   The  result
  21975.       of  this  is  that  it  works  only with plain-style password databases;
  21976.       shadow passwords will not be recognized.
  21977.  
  21978.  
  21979.  
  21980.  
  21981.  
  21982.  
  21983.  
  21984.  
  21985.  
  21986.  
  21987.                                  - 333 -
  21988.  
  21989.  
  21990.  
  21991.       19.5  nntpd Interaction with C News
  21992.  
  21993.  
  21994.  
  21995.  
  21996.            When receiving an article, nntpd has to deliver it to the news sub-
  21997.       system.  Depending on whether it was received as a result of an IHAVE or
  21998.       POST command, the article is handed to  rnews  or  inews,  respectively.
  21999.       Instead  of  invoking rnews, you may also configure it (at compile time)
  22000.       to batch the  incoming  articles  and  move  the  resulting  batches  to
  22001.       /var/spool/news/in.coming,  where  they  are  left for relaynews to pick
  22002.       them up at the next queue run.
  22003.  
  22004.  
  22005.            To be able to properly perform the ihave/sendme protocol, nntpd has
  22006.       to  be  able  to access the history file. At compile time, you therefore
  22007.       have to make sure the path is set correctly.  You should also make  sure
  22008.       that  C  news and nntpd agree on the format of your history file. C news
  22009.       uses dbm hashing functions to access it; however, there are quite a num-
  22010.       ber  of  different  and slightly incompatible implementations of the dbm
  22011.       library.  If C news has been linked with the  a  different  dbm  library
  22012.       than  you  have  in your standard libc, you have to link nntpd with this
  22013.       library, too.
  22014.  
  22015.  
  22016.             A typical symptom of nntpd and C news disagreeing on the  database
  22017.       format are error messages in the system log that nntpd could not open it
  22018.       properly, or duplicate articles received via NNTP.  A good  test  is  to
  22019.       pick an article from your spool area, telnet to the nntp port, and offer
  22020.       it to nntpd as shown in the example below (your  input  is  marked  like
  22021.       this).   Of  course, you have to replace <msg@id> with the message-ID of
  22022.       the article you want to feed to nntpd again.
  22023.  
  22024.  
  22025.            $ telnet localhost nntp
  22026.            Trying 127.0.0.1...
  22027.            Connected to loalhost
  22028.            Escape characters is '^]'.
  22029.            201 vstout NNTP[auth] server version 1.5.11t (16 November
  22030.            1991) ready at Sun Feb 6 16:02:32 1194 (no posting)
  22031.            IHAVE <msg@id>
  22032.            435 Got it.
  22033.            QUIT
  22034.  
  22035.  
  22036.  
  22037.  
  22038.            This  conversation  shows the proper reaction of nntpd; the message
  22039.       ``Got it'' tells you that it already has this article. If you get a mes-
  22040.       sage  of  ``335  Ok'' instead, the lookup in the history file failed for
  22041.       some reason. Terminate the conversation by typing Ctrl-D.  You can check
  22042.       what  has gone wrong by checking the system log; nntpd logs all kinds of
  22043.       messages to the daemon facility of syslog.  An incompatible dbm  library
  22044.       usually manifests itself in a message complaining that dbminit failed.
  22045.  
  22046.  
  22047.  
  22048.  
  22049.  
  22050.  
  22051.  
  22052.  
  22053.                                  - 334 -
  22054.  
  22055.  
  22056.  
  22057.  
  22058.  
  22059.  
  22060.  
  22061.  
  22062.  
  22063.  
  22064.  
  22065.  
  22066.  
  22067.  
  22068.  
  22069.  
  22070.  
  22071.  
  22072.  
  22073.  
  22074.  
  22075.  
  22076.  
  22077.  
  22078.  
  22079.  
  22080.  
  22081.  
  22082.  
  22083.  
  22084.  
  22085.  
  22086.  
  22087.  
  22088.  
  22089.  
  22090.  
  22091.  
  22092.  
  22093.  
  22094.  
  22095.  
  22096.  
  22097.  
  22098.  
  22099.  
  22100.  
  22101.  
  22102.  
  22103.  
  22104.  
  22105.  
  22106.  
  22107.  
  22108.  
  22109.  
  22110.  
  22111.  
  22112.  
  22113.  
  22114.  
  22115.  
  22116.  
  22117.  
  22118.  
  22119.                                  - 335 -
  22120.  
  22121.  
  22122.  
  22123.       20.  Newsreader Configuration
  22124.  
  22125.  
  22126.  
  22127.  
  22128.            Newsreaders  are  intended  to  offer  the  user functionality that
  22129.       allows her to access the functions of the news system easily, like post-
  22130.       ing  articles,  or skimming the contents of a newsgroup in a comfortable
  22131.       way.  The quality of this interface is subject of endless flame wars.
  22132.  
  22133.  
  22134.            There are a couple of newsreaders available which have been  ported
  22135.       to Linux. Below I will describe the basic setup for the three most popu-
  22136.       lar ones, namely tin, trn, and nn.
  22137.  
  22138.  
  22139.            One of the most effective newsreaders is
  22140.  
  22141.  
  22142.  
  22143.            $ find /var/spool/news -name '[0-9]*' -exec cat {} \; | more
  22144.  
  22145.  
  22146.  
  22147.  
  22148.            This is the way Un*x die-hards read their news.
  22149.  
  22150.  
  22151.            The  majority of newsreaders, however, are much more sophisticated.
  22152.       They usually offer a full-screen interface with separate levels for dis-
  22153.       playing  all  groups  the  user  has  subscribed  to,  for displaying an
  22154.       overview of all articles in one group. and for individual articles.
  22155.  
  22156.  
  22157.            At the newsgroup level, most newsreaders display a  list  of  arti-
  22158.       cles,  showing  their subject line, and the author. In big groups, it is
  22159.       impossible for the user to keep  track  of  articles  relating  to  each
  22160.       other,  although  it  is possible to identify responses to earlier arti-
  22161.       cles.
  22162.  
  22163.  
  22164.              A  response  usually  repeats  the  original  article's  subject,
  22165.       prepending it with ``Re: ''. Additionally, the message id of the article
  22166.       it is a direct follow-up to may be given in the References: header line.
  22167.       Sorting  articles  by  these  two  criteria generates small clusters (in
  22168.       fact, trees) of articles, which are called threads. One of the tasks  in
  22169.       writing  a  newsreader  is  devising  an  efficient scheme of threading,
  22170.       because the time required for this is proportional to the square of  the
  22171.       number of articles.
  22172.  
  22173.  
  22174.            Here,  we will not dig any further into how the user interfaces are
  22175.       built. All newsreaders currently available for Linux have  a  good  help
  22176.       function, so you ought to get along.
  22177.  
  22178.  
  22179.  
  22180.  
  22181.  
  22182.  
  22183.  
  22184.  
  22185.                                  - 336 -
  22186.  
  22187.  
  22188.  
  22189.            In the following, we will only deal with administrative tasks. Most
  22190.       of these relate to the creation of threads databases and accounting.
  22191.  
  22192.  
  22193.       20.1  tin Configuration
  22194.  
  22195.  
  22196.  
  22197.  
  22198.            The most versatile newsreader with respect to threading is tin.  It
  22199.       was  written  by  Iain Lea and is loosely modeled on an older newsreader
  22200.       named tass.(1) It does its threading when the user enters the newsgroup,
  22201.       and it is pretty fast at this unless you're doing this via NNTP.
  22202.  
  22203.  
  22204.             On an 486DX50, it takes roughly 30 seconds to thread 1000 articles
  22205.       when reading directly from disk.  Over NNTP to  a  loaded  news  server,
  22206.       this would be somewhere above 5 minutes.(2) You may improve this by reg-
  22207.       ularly updating your index file with the -u option, or by  invoking  tin
  22208.       with the -U option.
  22209.  
  22210.  
  22211.            Usually,  tin  dumps  its  threading  databases  in the user's home
  22212.       directory below .tin/index. This may  however  be  costly  in  terms  of
  22213.       resources,  so  that  you should want to keep a single copy of them in a
  22214.       central location. This may be achieved by making tin setuid to news, for
  22215.       example,  or  some  entirely unprivileged account.(3) tin will then keep
  22216.       all thread databases below /var/spool/news/.index.  For any file  access
  22217.       or  shell escape, it will reset its effective uid to the real uid of the
  22218.       user who invoked it.(4)
  22219.  
  22220.  
  22221.             A better solution is to install the tind indexing daemon that runs
  22222.       as  a daemon and regularly updates the index files.  This daemon is how-
  22223.       ever not included in any release of Linux, so you would have to  compile
  22224.       it  yourself.  If  you are running a LAN with a central news server, you
  22225.       may even run tind on the server and have all clients retrieve the  index
  22226.       files  via NNTP. This, of course, requires an extension to NNTP. Patches
  22227.       for nntpd that implement this extension are included in the tin  source.
  22228.  
  22229.  
  22230.            The version of tin included in some Linux distributions has no NNTP
  22231.       support compiled in, but most do have it now.  When invoked as  rtin  or
  22232.  
  22233.       
  22234.  
  22235.       1. Written by Rich Skrenta.
  22236.       2. Things  improve  drastically  if the NNTP server does the
  22237.          threading  itself,  and  lets  the  client  retrieve  the
  22238.          threads databases; INN-1.4 does this, for instance.
  22239.       3. However,  do not use nobody for this. As a rule, no files
  22240.          or commands whatsoever should  be  associated  with  this
  22241.          user.
  22242.       4. This is the reason why you will get ugly  error  messages
  22243.          when  invoking  it as super user. But then, you shouldn't
  22244.          work as root, anyway.
  22245.  
  22246.  
  22247.  
  22248.  
  22249.  
  22250.  
  22251.  
  22252.                                  - 337 -
  22253.  
  22254.  
  22255.  
  22256.       with the -r option, tin tries to connect to the NNTP server specified in
  22257.       the file /etc/nntpserver or in the NNTPSERVER environment variable.  The
  22258.       nntpserver file simply contains the server's name on a single line.
  22259.  
  22260.  
  22261.       20.2  trn Configuration
  22262.  
  22263.  
  22264.  
  22265.  
  22266.            trn  is the successor to an older newsreader, too, namely rn (which
  22267.       means read news). The ``t'' in its name stands for ``threaded''.  It was
  22268.       written by Wayne Davidson.
  22269.  
  22270.  
  22271.              Unlike  tin,  trn  has  no provision for generating its threading
  22272.       database at run-time. Instead, it  uses  those  prepared  by  a  program
  22273.       called mthreads that has to be invoked regularly from cron to update the
  22274.       index files.
  22275.  
  22276.  
  22277.             Not running mthreads, however, doesn't mean you cannot access  new
  22278.       articles,  it  only  means  you  will  have  all those ``Novell buys out
  22279.       Linix!!'' articles scattered across your article selection menu, instead
  22280.       of a single thread you may easily skip.
  22281.  
  22282.  
  22283.            To turn on threading for particular newsgroups, mthreads is invoked
  22284.       with the list of newsgroups on the command line.  The list is made up in
  22285.       exactly the same fashion as the one in the sys file:
  22286.  
  22287.  
  22288.  
  22289.            mthreads comp,rec,!rec.games.go
  22290.  
  22291.  
  22292.  
  22293.  
  22294.       will  enable  threading for all of comp and rec, except for rec.games.go
  22295.       (people who play Go don't need fancy threads). After  that,  you  simply
  22296.       invoke  it without any option at all to make it thread any newly arrived
  22297.       articles.  Threading of all groups found in  your  active  file  can  be
  22298.       turned on by invoking mthreads with a group list of all.
  22299.  
  22300.  
  22301.            If you're receiving news during the night, you will customarily run
  22302.       mthreads once in the morning, but you can also to do so more  frequently
  22303.       if  needed.  Sites that have very heavy traffic may want to run mthreads
  22304.       in daemon mode.  When it is started at boot time using the -d option, it
  22305.       puts itself in the background, and wakes up every 10 minutes to check if
  22306.       there are any newly-arrived articles, and threads them. To run  mthreads
  22307.       in daemon mode, put the following line in your rc.news script:
  22308.  
  22309.  
  22310.  
  22311.  
  22312.  
  22313.  
  22314.  
  22315.  
  22316.  
  22317.  
  22318.                                  - 338 -
  22319.  
  22320.  
  22321.  
  22322.            /usr/local/bin/rn/mthreads -deav
  22323.  
  22324.  
  22325.  
  22326.  
  22327.            The -a option makes mthread automatically turn on threading for new
  22328.       groups as they are created; -v enables verbose log messages to mthreads'
  22329.       log file, mt.log in the directory where you have trn installed.
  22330.  
  22331.  
  22332.              Old  articles  no longer available must be removed from the index
  22333.       files regularly.  By default, only articles whose number  is  below  the
  22334.       low  water  mark will be removed.(5) Articles above this number who have
  22335.       been expired nevertheless (because the oldest article has been  assigned
  22336.       an  long expiry date by an Expires: header field) may be removed by giv-
  22337.       ing mthreads the -e option to force an  ``enhanced''  expiry  run.  When
  22338.       mthreads  is  running in daemon mode, the -e option makes it put in such
  22339.       an enhanced expiry run once a day, shortly after midnight.
  22340.  
  22341.  
  22342.       20.3  nn Configuration
  22343.  
  22344.  
  22345.  
  22346.  
  22347.            nn, written by Kim F. Storm, claims to be a newsreader whose  ulti-
  22348.       mate goal is not to read news. It's name stands for ``No News'', and its
  22349.       motto is ``No news is good news. nn is better.''
  22350.  
  22351.  
  22352.            To achieve this ambitious goal, nn comes along with a large assort-
  22353.       ment of maintenance tools that not only allow generation of threads, but
  22354.       also extensive checks on the consistency of these databases, accounting,
  22355.       gathering of usage statistics, and access restrictions. There is also an
  22356.       administration program called nnadmin, which allows you to perform these
  22357.       tasks  interactively.   It is very intuitive, hence we will not dwell on
  22358.       these aspects, and only deal with the generation of the index files.
  22359.  
  22360.  
  22361.             The nn threads database manager is called nnmaster.  It is usually
  22362.       run  as  a  daemon,  started from the rc.news or rc.inet2 script.  It is
  22363.       invoked as
  22364.  
  22365.  
  22366.  
  22367.            /usr/local/lib/nn/nnmaster -l -r -C
  22368.  
  22369.  
  22370.  
  22371.  
  22372.  
  22373.       
  22374.  
  22375.       5. Note  that  C  news  doesn't  update  this low water mark
  22376.          automatically; you have to run updatemin to do so. Please
  22377.          refer to chapter 18..
  22378.  
  22379.  
  22380.  
  22381.  
  22382.  
  22383.  
  22384.  
  22385.                                  - 339 -
  22386.  
  22387.  
  22388.  
  22389.            This enables threading for all newsgroups present  in  your  active
  22390.       file.
  22391.  
  22392.  
  22393.            Equivalently,  you may invoke nnmaster periodically from cron, giv-
  22394.       ing it a list of groups to act upon. This list is very  similar  to  the
  22395.       subscription list in the sys file, except that it uses blanks instead of
  22396.       commas. Instead of the fake group name all,  an  empty  argument  of  ""
  22397.       should be used to denote all groups.  A sample invocation is
  22398.  
  22399.  
  22400.  
  22401.            # /usr/local/lib/nn/nnmaster !rec.games.go rec comp
  22402.  
  22403.  
  22404.  
  22405.  
  22406.            Note  that the order is significant here: The leftmost group speci-
  22407.       fication that matches always wins. Thus, if  we  had  put  !rec.games.go
  22408.       after  rec, all articles from this group had been threaded nevertheless.
  22409.  
  22410.  
  22411.             nn offers several methods to  remove  expired  articles  from  its
  22412.       databases.   The  first  is  to update the database by scanning the news
  22413.       group directories and discarding the entries whose corresponding article
  22414.       is  no  longer  available.   This  is  the default operation obtained by
  22415.       invoking nnmaster with the -E  option.  It  is  reasonably  fast  unless
  22416.       you're doing this via NNTP.
  22417.  
  22418.  
  22419.            Method  2 behaves exactly like a default expiry run of mthreads, in
  22420.       that it only removes those entries that refer to articles  whose  number
  22421.       is  below the low water mark in the active file. It may be enabled using
  22422.       the -e option.
  22423.  
  22424.  
  22425.            Finally, a third strategy is to discard  the  entire  database  and
  22426.       recollect all articles. This may be done by giving -E3 to nnmaster.
  22427.  
  22428.  
  22429.            The  list  of groups to be expired is given by the -F option in the
  22430.       same fashion as above.  However, if you have nnmaster running as daemon,
  22431.       you  must  kill  it  (using -k) before expiry can take place, and to re-
  22432.       start it with the original options afterwards.  Thus the proper  command
  22433.       to run expire on all groups using method 1 is:
  22434.  
  22435.  
  22436.  
  22437.            # nnmaster -kF ""
  22438.            # nnmaster -lrC
  22439.  
  22440.  
  22441.  
  22442.  
  22443.  
  22444.  
  22445.  
  22446.  
  22447.  
  22448.  
  22449.  
  22450.  
  22451.                                  - 340 -
  22452.  
  22453.  
  22454.  
  22455.            There  are many more flags that may be used to fine-tune the behav-
  22456.       ior of nn. If you are concerned about removing bad articles or  digesti-
  22457.       fying article digests, read the nnmaster manual page.
  22458.  
  22459.  
  22460.            nnmaster  relies  on  a  file  named  GROUPS,  which  is located in
  22461.       /usr/local/lib/nn. If it does not exist initially, it is  created.   For
  22462.       each  newsgroup,  it  contains a line that begins with the group's name,
  22463.       optionally followed by a time stamp, and flags. You may edit these flags
  22464.       to  enable  certain  behavior for the group in question, but you may not
  22465.       change  the  order  in which the groups appear.(6) The flags allowed and
  22466.       their effects are detailed in the nnmaster manual page, too.
  22467.  
  22468.  
  22469.  
  22470.  
  22471.  
  22472.  
  22473.  
  22474.  
  22475.  
  22476.  
  22477.  
  22478.  
  22479.  
  22480.  
  22481.  
  22482.  
  22483.  
  22484.  
  22485.  
  22486.  
  22487.  
  22488.  
  22489.  
  22490.  
  22491.  
  22492.  
  22493.  
  22494.  
  22495.  
  22496.  
  22497.  
  22498.  
  22499.  
  22500.  
  22501.  
  22502.  
  22503.  
  22504.  
  22505.  
  22506.       
  22507.  
  22508.       6. This is because their order has to agree with that of the
  22509.          entries in the (binary) MASTER file.
  22510.  
  22511.  
  22512.  
  22513.  
  22514.  
  22515.  
  22516.  
  22517.                                  - 341 -
  22518.  
  22519.  
  22520.  
  22521.                                        APPENDIX A
  22522.  
  22523.  
  22524.                            A Null Printer Cable for PLIP
  22525.  
  22526.  
  22527.  
  22528.  
  22529.       To make a Null Printer Cable for use with a PLIP  connection,  you  need
  22530.       two  25-pin  connectors (called DB-25) and some 11-conductor cable.  The
  22531.       cable must be at most 15 meters long.
  22532.  
  22533.  
  22534.            If you look at the connector, you should be able to read tiny  num-
  22535.       bers  at  the base of each pin, from 1 for the pin top left (if you hold
  22536.       the broader side up) to 25 for  the  pin  bottom  right.  For  the  Null
  22537.       Printer cable, you have to connect the following pins of both connectors
  22538.       with each other:
  22539.  
  22540.  
  22541.       +------------------------------+
  22542.       |D0         2    15    ERROR   |
  22543.       |D1         3    13    SLCT    |
  22544.       |D2         4    12    PAPOUT  |
  22545.       |D3         5    10    ACK     |
  22546.       |D4         6    11    BUSY    |
  22547.       |GROUND    25    25    GROUND  |
  22548.       |ERROR     15     2    D0      |
  22549.       |SLCT      13     3    D1      |
  22550.       |PAPOUT    12     4    D2      |
  22551.       |ACK       10     5    D3      |
  22552.       |BUSY      11     6    D4      |
  22553.       +------------------------------+
  22554.  
  22555.            All remaining pins remain unconnected. If the  cable  is  shielded,
  22556.       the  shield should be connected to the DB-25's metallic shell on one end
  22557.       only.
  22558.  
  22559.  
  22560.  
  22561.  
  22562.  
  22563.  
  22564.  
  22565.  
  22566.  
  22567.  
  22568.  
  22569.  
  22570.  
  22571.  
  22572.  
  22573.  
  22574.  
  22575.  
  22576.  
  22577.  
  22578.  
  22579.  
  22580.  
  22581.  
  22582.  
  22583.                                  - 342 -
  22584.  
  22585.  
  22586.  
  22587.                                        APPENDIX B
  22588.  
  22589.  
  22590.                           Sample smail Configuration Files
  22591.  
  22592.  
  22593.  
  22594.  
  22595.            This section shows sample configuration files for a UUCP leaf  site
  22596.       on  a local area network. They are based on the sample files included in
  22597.       the source distribution of  smail-3.1.28.   Although  I  make  a  feeble
  22598.       attempt  to  explain  how  these files work, you are advised to read the
  22599.       very fine smail(8) manual page, which discusses  these  files  in  great
  22600.       length.  Once  you've  understood the basic idea behind smail configura-
  22601.       tion, it's worthwhile reading. It's easy!
  22602.  
  22603.  
  22604.            The first file shown is the routers file, which describes a set  of
  22605.       routers  to  smail.   When  smail  has  to  deliver a message to a given
  22606.       address, it hands the address to all routers in turn, until one of  them
  22607.       matches  it.   Matching here means that the router finds the destination
  22608.       host in its database, be it the  paths  file,  /etc/hosts,  or  whatever
  22609.       routing mechanism the router interfaces to.
  22610.  
  22611.  
  22612.            Entries  in  smail  configuration  files always begin with a unique
  22613.       name identifying the router, transport, or director.  They are  followed
  22614.       by a list of attributes that define its behavior.  This list consists of
  22615.       a set of global  attributes,  such  as  the  driver  used,  and  private
  22616.       attributes   that   are  only  understood  by  that  particular  driver.
  22617.       Attributes are separated by commas, while the sets of global and private
  22618.       attributes are separated from each other using a semicolon.
  22619.  
  22620.  
  22621.            To  make these fine distinctions clear, assume you want to maintain
  22622.       two separate pathalias files; one containing the routing information for
  22623.       your  domain,  and  a  second one containing global routing information,
  22624.       probably generatzed from the UUCP maps. With smail, you can now  specify
  22625.       two routers in the routers file, both of which use the pathalias driver.
  22626.       This driver looks up hostnames in a pathalias database. It expects to be
  22627.       given the name of the file in a private attribute:
  22628.  
  22629.  
  22630.  
  22631.  
  22632.  
  22633.  
  22634.  
  22635.  
  22636.  
  22637.  
  22638.  
  22639.  
  22640.  
  22641.  
  22642.  
  22643.  
  22644.  
  22645.  
  22646.  
  22647.  
  22648.  
  22649.                                  - 343 -
  22650.  
  22651.  
  22652.  
  22653.            #
  22654.            # pathalias database for intra-domain routing
  22655.            domain paths:
  22656.                    driver=pathalias,         # look up host in a paths file
  22657.                    transport=uux;            # if matched, deliver over UUCP
  22658.  
  22659.                    file=paths/domain,        # file is /usr/lib/smail/paths/domain
  22660.                    proto=lsearch,            # file is unsorted (linear search)
  22661.                    optional,                 # ignore if the file does not exist
  22662.                    required=vbrew.com,       # look up only *.vbrew.com hosts
  22663.  
  22664.            #
  22665.            # pathalias database for routing to hosts outside our domain
  22666.            world paths:
  22667.                    driver=pathalias,         # look up host in a paths file
  22668.                    transport=uux;            # if matched, deliver over UUCP
  22669.  
  22670.                    file=paths/world,         # file is /usr/lib/smail/paths/world
  22671.                    proto=bsearch,            # file is sorted with sort(1)
  22672.                    optional,                 # ignore if the file does not exist
  22673.                    -required,                # no required domains
  22674.                    domain=uucp,              # strip ending ".uucp" before searching
  22675.  
  22676.  
  22677.  
  22678.  
  22679.  
  22680.            The second global attribute  given  in  each  of  the  two  routers
  22681.       entries  above defines the transport that should be used when the router
  22682.       matches the address.  In our case, the message will be  delivered  using
  22683.       the uux transport.  Transports are defined in the transports file, which
  22684.       is exlained below.
  22685.  
  22686.  
  22687.            You can fine-tune by which transport a message will be delivered if
  22688.       you  specify  a mathod file instead of the transports attribute.  Method
  22689.       files provide a mapping from target hostnames to transports.   We  won't
  22690.       deal with them here.
  22691.  
  22692.  
  22693.            The following routers file defines routers for a local area network
  22694.       that query the resolver library.  On  an  Internet  host,  however,  you
  22695.       would  want  to use a router that handles MX records.  You should there-
  22696.       fore uncomment  the  alternative  inet bind  router  that  uses  smail's
  22697.       builtin BIND driver.
  22698.  
  22699.  
  22700.            In  an environment that mixes UUCP and TCP/IP, you may encounterthe
  22701.       problem that you have hosts in your /etc/hosts file that you  have  only
  22702.       occasional  SLIP  or PPP contact with.  Usually, you would still want to
  22703.       send any mail for them over UUCP. To prevent the inet hosts driver  from
  22704.       matching  these  hosts,  you have to put them into the paths/force file.
  22705.       This is another pathalias-style database, and is consulted before  smail
  22706.       queries the resolver.
  22707.  
  22708.  
  22709.  
  22710.  
  22711.  
  22712.  
  22713.  
  22714.  
  22715.                                  - 344 -
  22716.  
  22717.  
  22718.  
  22719.            # A sample /usr/lib/smail/routers file
  22720.            #
  22721.            # force - force UUCP delivery to certain hosts, even when
  22722.            #       they are in our /etc/hosts
  22723.            force:
  22724.                    driver=pathalias,         # look up host in a paths file
  22725.                    transport=uux;            # if matched, deliver over UUCP
  22726.  
  22727.                    file=paths/force,         # file is /usr/lib/smail/paths/force
  22728.                    optional,                 # ignore if the file does not exist
  22729.                    proto=lsearch,            # file is unsorted (linear search)
  22730.                    -required,                # no required domains
  22731.                    domain=uucp,              # strip ending ".uucp" before searching
  22732.  
  22733.  
  22734.            # inet addrs - match domain literals containing literal
  22735.            #       IP addresses, such as in janet@[191.72.2.1]
  22736.            inet addrs:
  22737.                    driver=gethostbyaddr,     # driver to match IP domain literals
  22738.                    transport=smtp;           # deliver using SMTP over TCP/IP
  22739.  
  22740.                    fail if error,            # fail if address is malformed
  22741.                    check for local,          # deliver directly if host is ourself
  22742.  
  22743.            # inet hosts - match hostnames with gethostbyname(3N)
  22744.            #       Comment this out if you wish to use the BIND version instead.
  22745.            inet hosts:
  22746.                    driver=gethostbyname,     # match hosts with the library function
  22747.                    transport=smtp;           # use default SMTP
  22748.  
  22749.                    -required,                # no required domains
  22750.                    -domain,                  # no defined domain suffixes
  22751.                    -only local domain,       # don't restrict to defined domains
  22752.  
  22753.            # inet hosts - alternate version using BIND to access the DNS
  22754.            #inet hosts:
  22755.            #       driver=bind,              # use built-in BIND driver
  22756.            #       transport=smtp;           # use TCP/IP SMTP for delivery
  22757.            #
  22758.            #       defnames,                 # use standard domain searching
  22759.            #       defer no connect,         # try again if the nameserver is down
  22760.            #       -local mx okay,           # fail (don't pass through) an MX
  22761.            #                                 # to the local host
  22762.  
  22763.            #
  22764.            # pathalias database for intra-domain routing
  22765.            domain paths:
  22766.                    driver=pathalias,         # look up host in a paths file
  22767.                    transport=uux;            # if matched, deliver over UUCP
  22768.  
  22769.                    file=paths/domain,        # file is /usr/lib/smail/paths/domain
  22770.                    proto=lsearch,            # file is unsorted (linear search)
  22771.                    optional,                 # ignore if the file does not exist
  22772.                    required=vbrew.com,       # look up only *.vbrew.com hosts
  22773.  
  22774.  
  22775.  
  22776.  
  22777.  
  22778.  
  22779.  
  22780.  
  22781.                                  - 345 -
  22782.  
  22783.  
  22784.  
  22785.            #
  22786.            # pathalias database for routing to hosts outside our domain
  22787.            world paths:
  22788.                    driver=pathalias,         # look up host in a paths file
  22789.                    transport=uux;            # if matched, deliver over UUCP
  22790.  
  22791.                    file=paths/world,         # file is /usr/lib/smail/paths/world
  22792.                    proto=bsearch,            # file is sorted with sort(1)
  22793.                    optional,                 # ignore if the file does not exist
  22794.                    -required,                # no required domains
  22795.                    domain=uucp,              # strip ending ".uucp" before searching
  22796.  
  22797.  
  22798.            # smart host - a partically specified smarthost director
  22799.            #       If the smart path attribute is not defined in
  22800.            #       /usr/lib/smail/config, this router is ignored.
  22801.            #       The transport attribute is overridden by the global
  22802.            #       smart transport variable
  22803.            smart host:
  22804.                    driver=smarthost,         # special-case driver
  22805.                    transport=uux;            # by default deliver over UUCP
  22806.  
  22807.                    -path,                    # use smart path config file variable
  22808.  
  22809.  
  22810.  
  22811.  
  22812.            The  handling  of  mail  for  local  addresses is configured in the
  22813.       directors file.  It is made up just like the routers file, with  a  list
  22814.       of entries that define a director each.  Directors do not deliver a mes-
  22815.       sage, they merely perform all the  redirection  that  is  possible,  for
  22816.       instance through aliases, mail forwarding, and the like.
  22817.  
  22818.  
  22819.            When  delivering  mail  to  a  local  address, such as janet, smail
  22820.       passes the usr name to all directors in turn. If a director matches,  it
  22821.       either  specifies  a  transport  the message should be delivered by (for
  22822.       instance, to the user's mailbox file), or generates a new  address  (for
  22823.       instance, after evaluating an alias).
  22824.  
  22825.  
  22826.            Because of the security issues involved, directors usually do a lot
  22827.       of checking of whether the files they use may  be  compromised  or  not.
  22828.       Addresses obtained in a somewhat dubious way (for instance from a world-
  22829.       writable aliases file) are flagged as unsecure.  Some transport  drivers
  22830.       will  turn down such addresses, for instance the transport that delivers
  22831.       a message to a file.
  22832.  
  22833.  
  22834.            Apart from this, smail also associates a user  with  each  address.
  22835.       Any  write  or  read operations are performed as the user.  For delivery
  22836.       to, say janet's mailbox, the address is of course associated with janet.
  22837.       Other  addresses,  such  as  those  obtained from the aliases file, have
  22838.       other users associated from them, for instance, the nobody user.
  22839.  
  22840.  
  22841.  
  22842.  
  22843.  
  22844.  
  22845.  
  22846.  
  22847.                                  - 346 -
  22848.  
  22849.  
  22850.  
  22851.            For details of these features, please refer to  the  smail(8)  man-
  22852.       page.
  22853.  
  22854.  
  22855.  
  22856.            # A sample /usr/lib/smail/directors file
  22857.  
  22858.            # aliasinclude - expand ":include:filename" addresses produced
  22859.            #       by alias files
  22860.            aliasinclude:
  22861.                    driver=aliasinclude,      # use this special-case driver
  22862.                    nobody;                   # access file as nobody user if unsecure
  22863.  
  22864.                    copysecure,               # get permissions from alias director
  22865.                    copyowners,               # get owners from alias director
  22866.  
  22867.            # forwardinclude - expand ":include:filename" addrs produced
  22868.            #       by forward files
  22869.            forwardinclude:
  22870.                    driver=forwardinclude,    # use this special-case driver
  22871.                    nobody;                   # access file as nobody user if unsecure
  22872.  
  22873.                    checkpath,                # check path accessibility
  22874.                    copysecure,               # get perms from forwarding director
  22875.                    copyowners,               # get owners from forwarding director
  22876.  
  22877.            # aliases - search for alias expansions stored in a database
  22878.            aliases:
  22879.                    driver=aliasfile,         # general-purpose aliasing director
  22880.                    -nobody,                  # all addresses are associated
  22881.                                              # with nobody by default anyway
  22882.                    sender okay,              # don't remove sender from expansions
  22883.                    owner=owner-$user;        # problems go to an owner address
  22884.  
  22885.                    file=/usr/lib/aliases,    # default: sendmail compatible
  22886.                    modemask=002,             # should not be globally writable
  22887.                    optional,                 # ignore if file does not exist
  22888.                    proto=lsearch,            # unsorted ASCII file
  22889.  
  22890.            # dotforward - expand .forward files in user home directories
  22891.            dotforward:
  22892.                    driver=forwardfile,       # general-purpose forwarding director
  22893.                    owner=real-$user,         # problems go to the user's mailbox
  22894.                    nobody,                   # use nobody user, if unsecure
  22895.                    sender okay;              # sender never removed from expansion
  22896.  
  22897.                    file=~/.forward,          # .forward file in home directories
  22898.                    checkowner,               # the user can own this file
  22899.                    owners=root,              # or root can own the file
  22900.                    modemask=002,             # it should not be globally writable
  22901.                    caution=0-10:uucp:daemon, # don't run things as root or daemons
  22902.                    # be extra careful of remotely accessible home directories
  22903.                    unsecure="~ftp:~uucp:~nuucp:/tmp:/usr/tmp",
  22904.  
  22905.  
  22906.  
  22907.  
  22908.  
  22909.  
  22910.  
  22911.  
  22912.  
  22913.                                  - 347 -
  22914.  
  22915.  
  22916.  
  22917.            # forwardto - expand a "Forward to " line at the top of
  22918.            #       the user's mailbox file
  22919.            forwardto:
  22920.                    driver=forwardfile,
  22921.                    owner=Postmaster,         # errors go to Postmaster
  22922.                    nobody,                   # use nobody user, if unsecure
  22923.                    sender okay;              # don't remove sender from expansion
  22924.  
  22925.                    file=/var/spool/mail/${lc:user}, # location of user's mailbox
  22926.                    forwardto,                # enable "Forward to " check
  22927.                    checkowner,               # the user can own this file
  22928.                    owners=root,              # or root can own the file
  22929.                    modemask=0002,            # under System V, group mail can write
  22930.                    caution=0-10:uucp:daemon, # don't run things as root or daemons
  22931.  
  22932.            # user - match users on the local host with delivery to their mailboxes
  22933.            user:   driver=user;              # driver to match usernames
  22934.  
  22935.                    transport=local,          # local transport goes to mailboxes
  22936.  
  22937.            # real user - match usernames when prefixed with the string "real-"
  22938.            real user:
  22939.                    driver=user;              # driver to match usernames
  22940.  
  22941.                    transport=local,          # local transport goes to mailboxes
  22942.                    prefix="real-",           # for example, match real-root
  22943.  
  22944.            # lists - expand mailing lists stored below /usr/lib/smail/lists
  22945.            lists:  driver=forwardfile,
  22946.                    caution,                  # flag all addresses with caution
  22947.                    nobody,                   # and then associate the nobody user
  22948.                    sender okay,              # do NOT remove the sender
  22949.                    owner=owner-$user;        # the list owner
  22950.  
  22951.                    # map the name of the mailing list to lower case
  22952.                    file=lists/${lc:user},
  22953.  
  22954.  
  22955.  
  22956.  
  22957.            After successfully routing or directing a message, smail hands  the
  22958.       message  to  the  transport  specified  by  the  router or director that
  22959.       matched the address. These transports  are  defined  in  the  transports
  22960.       file.  Again,  a  transport  is  defined  by a set of global and private
  22961.       options.
  22962.  
  22963.  
  22964.            The most important option defined by each entry is driver that han-
  22965.       dles the transport, for instance the pipe driver, which invokes the com-
  22966.       mand specified in the cmd attribute.  Apart from this, there are a  num-
  22967.       ber  of  global  attributes  a  transport  may use, that perform various
  22968.       transformations on the message header, and possibly message  body.   The
  22969.       return path  attribute,  for  instance,  makes  the  transport  insert a
  22970.       return path field in the message  header  The  unix from hack  attribute
  22971.  
  22972.  
  22973.  
  22974.  
  22975.  
  22976.  
  22977.  
  22978.  
  22979.                                  - 348 -
  22980.  
  22981.  
  22982.  
  22983.       makes it precede every occurrence of the word From at the beginning of a
  22984.       line with a > sign.
  22985.  
  22986.  
  22987.  
  22988.       # A sample /usr/lib/smail/transports file
  22989.  
  22990.       # local - deliver mail to local users
  22991.       local:  driver=appendfile,        # append message to a file
  22992.               return path,              # include a Return-Path: field
  22993.               from,                     # supply a From  envelope line
  22994.               unix from hack,           # insert > before From in body
  22995.               local;                    # use local forms for delivery
  22996.  
  22997.               file=/var/spool/mail/${lc:user}, # location of mailbox files
  22998.               group=mail,               # group to own file for System V
  22999.               mode=0660,                # group mail can access
  23000.               suffix="\n",              # append an extra newline
  23001.  
  23002.       # pipe - deliver mail to shell commands
  23003.       pipe:   driver=pipe,              # pipe message to another program
  23004.               return path,              # include a Return-Path: field
  23005.               from,                     # supply a From  envelope line
  23006.               unix from hack,           # insert > before From in body
  23007.               local;                    # use local forms for delivery
  23008.  
  23009.               cmd="/bin/sh -c $user", # send address to the Bourne Shell
  23010.               parent env,               # environment info from parent addr
  23011.               pipe as user,             # use user-id associated with address
  23012.               ignore status,            # ignore a non-zero exit status
  23013.               ignore write errors,      # ignore write errors, i.e., broken pipe
  23014.               umask=0022,               # umask for child process
  23015.               -log output,              # do not log stdout/stderr
  23016.  
  23017.       # file - deliver mail to files
  23018.       file:   driver=appendfile,
  23019.               return path,              # include a Return-Path: field
  23020.               from,                     # supply a From  envelope line
  23021.               unix from hack,           # insert > before From in body
  23022.               local;                    # use local forms for delivery
  23023.  
  23024.               file=$user,               # file is taken from address
  23025.               append as user,           # use user-id associated with address
  23026.               expand user,              # expand ~ and $ within address
  23027.               suffix="\n",              # append an extra newline
  23028.               mode=0600,                # set permissions to 600
  23029.  
  23030.       # uux - deliver to the rmail program on a remote UUCP site
  23031.       uux:    driver=pipe,
  23032.               uucp,                     # use UUCP-style addressing forms
  23033.               from,                     # supply a From  envelope line
  23034.               max addrs=5,              # at most 5 addresses per invocation
  23035.               max chars=200;            # at most 200 chars of addresses
  23036.  
  23037.  
  23038.  
  23039.  
  23040.  
  23041.  
  23042.  
  23043.  
  23044.  
  23045.                                  - 349 -
  23046.  
  23047.  
  23048.  
  23049.               cmd="/usr/bin/uux - -r -a$sender -g$grade $host!rmail $(($user)$)",
  23050.               pipe as sender,           # have uucp logs contain caller
  23051.               log output,               # save error output for bounce messages
  23052.       #       defer child errors,       # retry if uux returns an error
  23053.  
  23054.       # demand - deliver to a remote rmail program, polling immediately
  23055.       demand: driver=pipe,
  23056.               uucp,                     # use UUCP-style addressing forms
  23057.               from,                     # supply a From  envelope line
  23058.               max addrs=5,              # at most 5 addresses per invocation
  23059.               max chars=200;            # at most 200 chars of addresses
  23060.  
  23061.               cmd="/usr/bin/uux - -a$sender -g$grade $host!rmail $(($user)$)",
  23062.               pipe as sender,           # have uucp logs contain caller
  23063.               log output,               # save error output for bounce messages
  23064.       #       defer child errors,       # retry if uux returns an error
  23065.  
  23066.       # hbsmtp - half-baked BSMTP. The output files must
  23067.       #       be processed regularly and sent out via UUCP.
  23068.       hbsmtp: driver=appendfile,
  23069.               inet,                     # use RFC 822-addressing
  23070.               hbsmtp,                   # batched SMTP w/o HELO and QUIT
  23071.               -max addrs, -max chars;   # no limit on number of addresses
  23072.  
  23073.               file="/var/spool/smail/hbsmtp/$host",
  23074.               user=root,                # file is owned by root
  23075.               mode=0600,                # only read-/writeable by root.
  23076.  
  23077.       # smtp - deliver using SMTP over TCP/IP
  23078.       smtp:   driver=tcpsmtp,
  23079.               inet,
  23080.               -max addrs, -max chars;   # no limit on number of addresses
  23081.  
  23082.               short timeout=5m,               # timeout for short operations
  23083.               long timeout=2h,                # timeout for longer SMTP operations
  23084.               service=smtp,                   # connect to this service port
  23085.       # For internet use: uncomment the below 4 lines
  23086.       #       use bind,                       # resolve MX and multiple A records
  23087.       #       defnames,                       # use standard domain searching
  23088.       #       defer no connect,               # try again if the nameserver is down
  23089.       #       -local mx okay,                 # fail an MX to the local host
  23090.  
  23091.  
  23092.  
  23093.  
  23094.  
  23095.  
  23096.  
  23097.  
  23098.  
  23099.  
  23100.  
  23101.  
  23102.  
  23103.  
  23104.  
  23105.  
  23106.  
  23107.  
  23108.  
  23109.  
  23110.  
  23111.                                  - 350 -
  23112.  
  23113.  
  23114.  
  23115.                                        APPENDIX C
  23116.  
  23117.  
  23118.                            The GNU General Public License
  23119.  
  23120.  
  23121.  
  23122.  
  23123.            Printed below is the GNU General Public License (the GPL  or  copy-
  23124.       left),  under which Linux is licensed. It is reproduced here to clear up
  23125.       some of the confusion about  Linux's  copyright  status---Linux  is  not
  23126.       shareware,  and  it  is  not in the public domain. The bulk of the Linux
  23127.       kernel is copyright (C)1993 by Linus Torvalds, and  other  software  and
  23128.       parts  of  the  kernel are copyrighted by their authors.  Thus, Linux is
  23129.       copyrighted, however, you may redistribute it under the terms of the GPL
  23130.       printed below.
  23131.  
  23132.  
  23133.  
  23134.                                GNU GENERAL PUBLIC LICENSE
  23135.                                 Version 2, June 1991
  23136.  
  23137.  
  23138.            Copyright  (C)  1989, 1991 Free Software Foundation, Inc.  675 Mass
  23139.       Ave, Cambridge, MA 02139, USA Everyone is permitted  to  copy  and  dis-
  23140.       tribute verbatim copies of this license document, but changing it is not
  23141.       allowed.
  23142.  
  23143.  
  23144.       C.1  Preamble
  23145.  
  23146.       The licenses for most software are designed to take away your freedom to
  23147.       share  and  change  it.   By contrast, the GNU General Public License is
  23148.       intended to guarantee your freedom to share and change free software--to
  23149.       make  sure  the software is free for all its users.  This General Public
  23150.       License applies to most of the Free Software Foundation's  software  and
  23151.       to any other program whose authors commit to using it.  (Some other Free
  23152.       Software Foundation software is covered by the GNU Library General  Pub-
  23153.       lic License instead.)  You can apply it to your programs, too.
  23154.  
  23155.  
  23156.            When  we  speak  of free software, we are referring to freedom, not
  23157.       price.  Our General Public Licenses are designed to make sure  that  you
  23158.       have  the  freedom to distribute copies of free software (and charge for
  23159.       this service if you wish), that you receive source code or can get it if
  23160.       you want it, that you can change the software or use pieces of it in new
  23161.       free programs; and that you know you can do these things.
  23162.  
  23163.  
  23164.            To protect your rights, we need to make  restrictions  that  forbid
  23165.       anyone  to  deny you these rights or to ask you to surrender the rights.
  23166.       These restrictions translate to certain responsibilities for you if  you
  23167.       distribute copies of the software, or if you modify it.
  23168.  
  23169.  
  23170.  
  23171.  
  23172.  
  23173.  
  23174.  
  23175.  
  23176.  
  23177.                                  - 351 -
  23178.  
  23179.  
  23180.  
  23181.            For  example,  if  you distribute copies of such a program, whether
  23182.       gratis or for a fee, you must give the recipients all  the  rights  that
  23183.       you  have.   You  must  make sure that they, too, receive or can get the
  23184.       source code.  And you must show them these  terms  so  they  know  their
  23185.       rights.
  23186.  
  23187.  
  23188.            We  protect your rights with two steps: (1) copyright the software,
  23189.       and (2) offer you this license which gives you legal permission to copy,
  23190.       distribute and/or modify the software.
  23191.  
  23192.  
  23193.            Also,  for  each author's protection and ours, we want to make cer-
  23194.       tain that everyone understands that there is no warranty for  this  free
  23195.       software.  If the software is modified by someone else and passed on, we
  23196.       want its recipients to know that what they have is not the original,  so
  23197.       that  any problems introduced by others will not reflect on the original
  23198.       authors' reputations.
  23199.  
  23200.  
  23201.            Finally, any free program  is  threatened  constantly  by  software
  23202.       patents.  We wish to avoid the danger that redistributors of a free pro-
  23203.       gram will individually obtain patent licenses, in effect making the pro-
  23204.       gram  proprietary.   To  prevent  this,  we  have made it clear that any
  23205.       patent must be licensed for everyone's free use or not licensed at  all.
  23206.  
  23207.  
  23208.            The precise terms and conditions for copying, distribution and mod-
  23209.       ification follow.
  23210.  
  23211.  
  23212.       C.2  Terms and Conditions for Copying, Distribution, and Modification
  23213.  
  23214.  
  23215.  
  23216.         0.  This License applies to any program or other work which contains a
  23217.             notice placed by the copyright holder saying it may be distributed
  23218.             under the terms of this General Public License.  The  ``Program'',
  23219.             below,  refers  to any such program or work, and a ``work based on
  23220.             the Program'' means either the  Program  or  any  derivative  work
  23221.             under copyright law: that is to say, a work containing the Program
  23222.             or a portion of it, either verbatim or with  modifications  and/or
  23223.             translated  into  another  language.  (Hereinafter, translation is
  23224.             included without limitation in the term  ``modification''.)   Each
  23225.             licensee is addressed as ``you''.
  23226.  
  23227.  
  23228.                  Activities  other than copying, distribution and modification
  23229.             are not covered by this License; they are outside its scope.   The
  23230.             act  of running the Program is not restricted, and the output from
  23231.             the Program is covered only if  its  contents  constitute  a  work
  23232.             based  on  the Program (independent of having been made by running
  23233.             the Program).  Whether that is true depends on  what  the  Program
  23234.             does.
  23235.  
  23236.  
  23237.  
  23238.  
  23239.  
  23240.  
  23241.  
  23242.  
  23243.                                  - 352 -
  23244.  
  23245.  
  23246.  
  23247.         1.  You  may  copy  and  distribute  verbatim  copies of the Program's
  23248.             source code as you receive it, in any medium,  provided  that  you
  23249.             conspicuously  and appropriately publish on each copy an appropri-
  23250.             ate copyright notice and disclaimer of warranty; keep  intact  all
  23251.             the  notices  that refer to this License and to the absence of any
  23252.             warranty; and give any other recipients of the Program a  copy  of
  23253.             this License along with the Program.
  23254.  
  23255.  
  23256.                  You  may  charge a fee for the physical act of transferring a
  23257.             copy, and you may at your  option  offer  warranty  protection  in
  23258.             exchange for a fee.
  23259.  
  23260.  
  23261.         2.  You  may  modify your copy or copies of the Program or any portion
  23262.             of it, thus forming a work based on the Program, and copy and dis-
  23263.             tribute  such  modifications  or work under the terms of Section 1
  23264.             above, provided that you also meet all of these conditions:
  23265.  
  23266.  
  23267.  
  23268.  
  23269.               a.  You must cause the modified files to carry prominent notices
  23270.                   stating  that  you  changed  the  files  and the date of any
  23271.                   change.
  23272.  
  23273.  
  23274.               b.  You must cause any work that you distribute or publish, that
  23275.                   in  whole or in part contains or is derived from the Program
  23276.                   or any part thereof, to be licensed as a whole at no  charge
  23277.                   to all third parties under the terms of this License.
  23278.  
  23279.  
  23280.               c.  If  the  modified  program  normally reads commands interac-
  23281.                   tively when run, you must cause it, when started running for
  23282.                   such  interactive  use in the most ordinary way, to print or
  23283.                   display an announcement including an  appropriate  copyright
  23284.                   notice and a notice that there is no warranty (or else, say-
  23285.                   ing that you provide a warranty) and that users  may  redis-
  23286.                   tribute  the program under these conditions, and telling the
  23287.                   user how to view a copy of this License.  (Exception: if the
  23288.                   Program  itself  is  interactive but does not normally print
  23289.                   such an announcement, your work based on the Program is  not
  23290.                   required to print an announcement.)
  23291.  
  23292.  
  23293.  
  23294.                  These requirements apply to the modified work as a whole.  If
  23295.             identifiable sections of that work are not derived from  the  Pro-
  23296.             gram,  and  can  be reasonably considered independent and separate
  23297.             works in themselves, then this License,  and  its  terms,  do  not
  23298.             apply  to  those  sections  when  you  distribute them as separate
  23299.             works.  But when you distribute the same sections  as  part  of  a
  23300.             whole  which  is  a work based on the Program, the distribution of
  23301.  
  23302.  
  23303.  
  23304.  
  23305.  
  23306.  
  23307.  
  23308.  
  23309.                                  - 353 -
  23310.  
  23311.  
  23312.  
  23313.             the whole must be on the terms of this License, whose  permissions
  23314.             for  other  licensees extend to the entire whole, and thus to each
  23315.             and every part regardless of who wrote it.
  23316.  
  23317.  
  23318.                  Thus, it is not the intent of this section to claim rights or
  23319.             contest  your  rights to work written entirely by you; rather, the
  23320.             intent is to exercise the right to  control  the  distribution  of
  23321.             derivative or collective works based on the Program.
  23322.  
  23323.  
  23324.                  In  addition,  mere  aggregation of another work not based on
  23325.             the Program with the Program (or with a work based on the Program)
  23326.             on a volume of a storage or distribution medium does not bring the
  23327.             other work under the scope of this License.
  23328.  
  23329.  
  23330.         3.  You may copy and distribute the Program (or a work  based  on  it,
  23331.             under Section 2) in object code or executable form under the terms
  23332.             of Sections 1 and 2 above provided that you also  do  one  of  the
  23333.             following:
  23334.  
  23335.  
  23336.  
  23337.  
  23338.               a.  Accompany   it  with  the  complete  corresponding  machine-
  23339.                   readable source code, which must be  distributed  under  the
  23340.                   terms of Sections 1 and 2 above on a medium customarily used
  23341.                   for software interchange; or,
  23342.  
  23343.  
  23344.               b.  Accompany it with a written offer, valid for at least  three
  23345.                   years,  to  give  any third party, for a charge no more than
  23346.                   your cost of physically performing  source  distribution,  a
  23347.                   complete  machine-readable  copy of the corresponding source
  23348.                   code, to be distributed under the terms of Sections 1 and  2
  23349.                   above on a medium customarily used for software interchange;
  23350.                   or,
  23351.  
  23352.  
  23353.               c.  Accompany it with the information you  received  as  to  the
  23354.                   offer to distribute corresponding source code.  (This alter-
  23355.                   native is allowed only for  noncommercial  distribution  and
  23356.                   only  if  you  received  the  program in object code or exe-
  23357.                   cutable form with such an offer, in accord with Subsection b
  23358.                   above.)
  23359.  
  23360.  
  23361.  
  23362.                  The  source  code  for a work means the preferred form of the
  23363.             work for making modifications to it.  For an executable work, com-
  23364.             plete  source  code  means  all the source code for all modules it
  23365.             contains, plus any associated interface definition files, plus the
  23366.             scripts  used  to  control  compilation  and  installation  of the
  23367.  
  23368.  
  23369.  
  23370.  
  23371.  
  23372.  
  23373.  
  23374.  
  23375.                                  - 354 -
  23376.  
  23377.  
  23378.  
  23379.             executable.  However, as a special exception, the source code dis-
  23380.             tributed  need  not  include anything that is normally distributed
  23381.             (in either source or binary form) with the major components  (com-
  23382.             piler,  kernel,  and  so  on) of the operating system on which the
  23383.             executable runs, unless that component itself accompanies the exe-
  23384.             cutable.
  23385.  
  23386.  
  23387.                  If  distribution  of  executable  or  object  code is made by
  23388.             offering access to copy from a  designated  place,  then  offering
  23389.             equivalent  access  to  copy  the  source code from the same place
  23390.             counts as distribution of the source code, even though third  par-
  23391.             ties  are  not  compelled to copy the source along with the object
  23392.             code.
  23393.  
  23394.  
  23395.         4.  You may not copy, modify, sublicense, or  distribute  the  Program
  23396.             except as expressly provided under this License.  Any attempt oth-
  23397.             erwise to copy, modify, sublicense or distribute  the  Program  is
  23398.             void,  and  will  automatically  terminate  your rights under this
  23399.             License.  However, parties who have received  copies,  or  rights,
  23400.             from  you  under  this License will not have their licenses termi-
  23401.             nated so long as such parties remain in full compliance.
  23402.  
  23403.  
  23404.         5.  You are not required to accept this License, since  you  have  not
  23405.             signed  it.  However, nothing else grants you permission to modify
  23406.             or distribute the Program or its derivative works.  These  actions
  23407.             are  prohibited  by law if you do not accept this License.  There-
  23408.             fore, by modifying or distributing the Program (or any work  based
  23409.             on  the  Program), you indicate your acceptance of this License to
  23410.             do so, and all its terms and conditions for copying,  distributing
  23411.             or modifying the Program or works based on it.
  23412.  
  23413.  
  23414.         6.  Each  time  you redistribute the Program (or any work based on the
  23415.             Program), the recipient automatically receives a license from  the
  23416.             original  licensor  to copy, distribute or modify the Program sub-
  23417.             ject to these terms and conditions.  You may not impose  any  fur-
  23418.             ther  restrictions  on  the  recipients'  exercise  of  the rights
  23419.             granted herein.  You are not responsible for enforcing  compliance
  23420.             by third parties to this License.
  23421.  
  23422.  
  23423.         7.  If,  as  a consequence of a court judgment or allegation of patent
  23424.             infringement or for  any  other  reason  (not  limited  to  patent
  23425.             issues),  conditions  are  imposed on you (whether by court order,
  23426.             agreement or otherwise) that contradict  the  conditions  of  this
  23427.             License,  they  do  not  excuse  you  from  the conditions of this
  23428.             License.  If you cannot distribute so as to satisfy simultaneously
  23429.             your  obligations under this License and any other pertinent obli-
  23430.             gations, then as a consequence you may not distribute the  Program
  23431.             at  all.   For  example, if a patent license would not permit roy-
  23432.             alty-free redistribution of the Program by all those  who  receive
  23433.  
  23434.  
  23435.  
  23436.  
  23437.  
  23438.  
  23439.  
  23440.  
  23441.                                  - 355 -
  23442.  
  23443.  
  23444.  
  23445.             copies  directly  or indirectly through you, then the only way you
  23446.             could satisfy both  it  and  this  License  would  be  to  refrain
  23447.             entirely from distribution of the Program.
  23448.  
  23449.  
  23450.                  If  any portion of this section is held invalid or unenforce-
  23451.             able under any particular circumstance, the balance of the section
  23452.             is  intended  to  apply  and the section as a whole is intended to
  23453.             apply in other circumstances.
  23454.  
  23455.  
  23456.                  It is not the purpose  of  this  section  to  induce  you  to
  23457.             infringe  any patents or other property right claims or to contest
  23458.             validity of any such claims; this section has the sole purpose  of
  23459.             protecting the integrity of the free software distribution system,
  23460.             which is implemented by public  license  practices.   Many  people
  23461.             have  made  generous  contributions  to the wide range of software
  23462.             distributed through that system in reliance on consistent applica-
  23463.             tion  of that system; it is up to the author/donor to decide if he
  23464.             or she is willing to distribute software through any other  system
  23465.             and a licensee cannot impose that choice.
  23466.  
  23467.  
  23468.                  This  section  is  intended  to make thoroughly clear what is
  23469.             believed to be a consequence of the rest of this License.
  23470.  
  23471.  
  23472.         8.  If the distribution and/or use of the  Program  is  restricted  in
  23473.             certain  countries either by patents or by copyrighted interfaces,
  23474.             the original copyright holder who places the  Program  under  this
  23475.             License  may  add an explicit geographical distribution limitation
  23476.             excluding those countries, so that distribution is permitted  only
  23477.             in  or  among  countries  not  thus  excluded.  In such case, this
  23478.             License incorporates the limitation as if written in the  body  of
  23479.             this License.
  23480.  
  23481.  
  23482.         9.  The  Free  Software Foundation may publish revised and/or new ver-
  23483.             sions of the General Public License from time to time.   Such  new
  23484.             versions will be similar in spirit to the present version, but may
  23485.             differ in detail to address new problems or concerns.
  23486.  
  23487.  
  23488.                  Each version is given a distinguishing  version  number.   If
  23489.             the  Program  specifies  a  version  number  of this License which
  23490.             applies to it and ``any later version'', you have  the  option  of
  23491.             following  the  terms  and conditions either of that version or of
  23492.             any later version published by the Free Software  Foundation.   If
  23493.             the Program does not specify a version number of this License, you
  23494.             may choose any version ever published by the Free Software Founda-
  23495.             tion.
  23496.  
  23497.  
  23498.  
  23499.  
  23500.  
  23501.  
  23502.  
  23503.  
  23504.  
  23505.  
  23506.  
  23507.                                  - 356 -
  23508.  
  23509.  
  23510.  
  23511.        10.  If  you  wish  to incorporate parts of the Program into other free
  23512.             programs whose distribution conditions are different, write to the
  23513.             author  to  ask for permission.  For software which is copyrighted
  23514.             by the Free Software Foundation, write to the Free Software  Foun-
  23515.             dation;  we sometimes make exceptions for this.  Our decision will
  23516.             be guided by the two goals of preserving the free  status  of  all
  23517.             derivatives  of our free software and of promoting the sharing and
  23518.             reuse of software generally.
  23519.  
  23520.  
  23521.  
  23522.                                           NO WARRANTY
  23523.  
  23524.  
  23525.        11.  BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS  NO  WAR-
  23526.             RANTY  FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
  23527.             EXCEPT WHEN OTHERWISE STATED  IN  WRITING  THE  COPYRIGHT  HOLDERS
  23528.             AND/OR  OTHER  PARTIES  PROVIDE THE PROGRAM ``AS IS'' WITHOUT WAR-
  23529.             RANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
  23530.             LIMITED  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  23531.             FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE  QUALITY  AND
  23532.             PERFORMANCE  OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE
  23533.             DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,  REPAIR
  23534.             OR CORRECTION.
  23535.  
  23536.  
  23537.        12.  IN  NO  EVENT  UNLESS  REQUIRED  BY APPLICABLE LAW OR AGREED TO IN
  23538.             WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MOD-
  23539.             IFY  AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE
  23540.             TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL  OR
  23541.             CONSEQUENTIAL  DAMAGES  ARISING OUT OF THE USE OR INABILITY TO USE
  23542.             THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS  OF  DATA  OR  DATA
  23543.             BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PAR-
  23544.             TIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH  ANY  OTHER  PRO-
  23545.             GRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  23546.             POSSIBILITY OF SUCH DAMAGES.
  23547.  
  23548.  
  23549.  
  23550.                             END OF TERMS AND CONDITIONS
  23551.  
  23552.  
  23553.       C.3  Appendix: How to Apply These Terms to Your New Programs
  23554.  
  23555.       If you develop a new program, and you want it to be of the greatest pos-
  23556.       sible use to the public, the best way to achieve this is to make it free
  23557.       software which everyone can redistribute and change under these terms.
  23558.  
  23559.  
  23560.            To do so, attach the following  notices  to  the  program.   It  is
  23561.       safest  to  attach  them to the start of each source file to most effec-
  23562.       tively convey the exclusion of warranty; and each file  should  have  at
  23563.       least  the  ``copyright'' line and a pointer to where the full notice is
  23564.       found.
  23565.  
  23566.  
  23567.  
  23568.  
  23569.  
  23570.  
  23571.  
  23572.  
  23573.                                  - 357 -
  23574.  
  23575.  
  23576.  
  23577.            <one line to give the program's name and a brief idea  of
  23578.            what it does.> Copyright (C)19yy  <name of author>
  23579.  
  23580.  
  23581.            This  program  is  free software; you can redistribute it
  23582.            and/or modify it under the terms of the GNU General  Pub-
  23583.            lic License as published by the Free Software Foundation;
  23584.            either version 2 of the License, or (at your option)  any
  23585.            later version.
  23586.  
  23587.  
  23588.            This  program  is distributed in the hope that it will be
  23589.            useful,  but  WITHOUT  ANY  WARRANTY;  without  even  the
  23590.            implied warranty of MERCHANTABILITY or FITNESS FOR A PAR-
  23591.            TICULAR PURPOSE.  See the GNU General Public License  for
  23592.            more details.
  23593.  
  23594.  
  23595.            You should have received a copy of the GNU General Public
  23596.            License along with this program; if  not,  write  to  the
  23597.            Free  Software Foundation, Inc., 675 Mass Ave, Cambridge,
  23598.            MA 02139, USA.
  23599.  
  23600.  
  23601.  
  23602.            Also  add information on how to contact you by electronic and paper
  23603.       mail.
  23604.  
  23605.  
  23606.            If the program is interactive, make it output a short  notice  like
  23607.       this when it starts in an interactive mode:
  23608.  
  23609.  
  23610.            Gnomovision version 69, Copyright (C) 19yy name of author
  23611.            Gnomovision  comes  with  ABSOLUTELY  NO  WARRANTY;   for
  23612.            details  type  `show  w'.  This is free software, and you
  23613.            are welcome to redistribute it under certain  conditions;
  23614.            type `show c' for details.
  23615.  
  23616.  
  23617.  
  23618.  
  23619.            The hypothetical commands `show w' and `show  c'  should  show  the
  23620.       appropriate  parts  of  the General Public License.  Of course, the com-
  23621.       mands you use may be called something other than `show w' and `show  c';
  23622.       they  could even be mouse-clicks or menu items--whatever suits your pro-
  23623.       gram.
  23624.  
  23625.  
  23626.            You should also get your employer (if you work as a programmer)  or
  23627.       your school, if any, to sign a ``copyright disclaimer'' for the program,
  23628.       if necessary.  Here is a sample; alter the names:
  23629.  
  23630.  
  23631.  
  23632.  
  23633.  
  23634.  
  23635.  
  23636.  
  23637.  
  23638.  
  23639.                                  - 358 -
  23640.  
  23641.  
  23642.  
  23643.            Yoyodyne, Inc., hereby disclaims all  copyright  interest
  23644.            in  the program `Gnomovision' (which makes passes at com-
  23645.            pilers) written by James Hacker.
  23646.  
  23647.  
  23648.            <signature of Ty Coon>, 1 April 1989 Ty  Coon,  President
  23649.            of Vice
  23650.  
  23651.  
  23652.  
  23653.            This General Public License does not permit incorporating your pro-
  23654.       gram  into  proprietary  programs.   If  your  program  is  a subroutine
  23655.       library, you may consider it more useful to permit  linking  proprietary
  23656.       applications  with the library.  If this is what you want to do, use the
  23657.       GNU Library General Public License instead of this License.
  23658.  
  23659.  
  23660.  
  23661.  
  23662.  
  23663.  
  23664.  
  23665.  
  23666.  
  23667.  
  23668.  
  23669.  
  23670.  
  23671.  
  23672.  
  23673.  
  23674.  
  23675.  
  23676.  
  23677.  
  23678.  
  23679.  
  23680.  
  23681.  
  23682.  
  23683.  
  23684.  
  23685.  
  23686.  
  23687.  
  23688.  
  23689.  
  23690.  
  23691.  
  23692.  
  23693.  
  23694.  
  23695.  
  23696.  
  23697.  
  23698.  
  23699.  
  23700.  
  23701.  
  23702.  
  23703.  
  23704.  
  23705.                                  - 359 -
  23706.  
  23707.  
  23708.  
  23709.       Glossary
  23710.  
  23711.       [Meta: This could use more entries, and a little polishing.   Feel  free
  23712.       to make suggestions.]
  23713.  
  23714.  
  23715.            An  enormous  difficulty  in networking is to remember what all the
  23716.       abbreviations and terms one encounters really mean.  Here's  a  list  of
  23717.       those  used frequently throughout the guide, along with a short explana-
  23718.       tion.
  23719.  
  23720.  
  23721.  
  23722.  
  23723.             ACU Automatic Call Unit. A modem.(1)
  23724.  
  23725.  
  23726.             ARP Address Resolution Protocol. Used to map IP addresses to  Eth-
  23727.                 ernet addresses.
  23728.  
  23729.  
  23730.            ARPA Advanced  Research Project Agency, later DARPA. Founder of the
  23731.                 Internet.
  23732.  
  23733.  
  23734.         ARPANET The ancestor of  today's  Internet;  an  experimental  network
  23735.                 funded  by  the  U.S. Defense Advanced Research Project Agency
  23736.                 (DARPA).
  23737.  
  23738.  
  23739.       Assigned Numbers The title of an RFC published regularly that lists  the
  23740.                 publicly  allocated  numbers used for various things in TCP/IP
  23741.                 networking. For example, it contains the list of all port num-
  23742.                 bers of well-known services like rlogin, telnet, etc. The most
  23743.                 recent release of this document is RFC 1340.
  23744.  
  23745.  
  23746.       bang path In UUCP networks, a special notation for  the  path  from  one
  23747.                 UUCP  site to another. The name derives from the use of excla-
  23748.                 mation marks (`bangs') to separate the  host  names.  Example:
  23749.                 foo!bar!ernie!bert denotes a path to host bert, travelling (in
  23750.                 this order) foo, bar, and ernie.
  23751.  
  23752.  
  23753.             BBS Bulletin Board System. A dial-up mailbox system.
  23754.  
  23755.  
  23756.             BGP Border Gateway Protocol. A  protocol  for  exchanging  routing
  23757.                 information between autonomous systems.
  23758.  
  23759.  
  23760.  
  23761.       
  23762.  
  23763.       1. Alternatively: A teenager with a telephone.
  23764.  
  23765.  
  23766.  
  23767.  
  23768.  
  23769.  
  23770.  
  23771.                                  - 360 -
  23772.  
  23773.  
  23774.  
  23775.            BIND The Berkeley Internet Name Domain server. An implementation of
  23776.                 a DNS server.
  23777.  
  23778.  
  23779.             BNU Basic Networking Utilities. This is the most common UUCP vari-
  23780.                 ety  at  the  moment.   It  is also known as HoneyDanBer UUCP.
  23781.                 This name is derived from the  authors'  names:  P.  Honeyman,
  23782.                 D.A. Novitz, and B.E. Redman.
  23783.  
  23784.  
  23785.       broadcast network A  network  that allows one station to address a data-
  23786.                 gram to all other stations on the network simultaneously.
  23787.  
  23788.  
  23789.             BSD Berkeley Software Distribution. A Un*x flavor.
  23790.  
  23791.  
  23792.       canonical hostname A host's primary name within the Domain Name  System.
  23793.                 This  is  the host's only name that has an A record associated
  23794.                 with it, and which  is  returned  when  performing  a  reverse
  23795.                 lookup.
  23796.  
  23797.  
  23798.           CCITT Comite    Consultatif   International   de    Tlgraphique   et
  23799.                 Tlphonique. An International organization  of  telephone  ser-
  23800.                 vices, etc.
  23801.  
  23802.  
  23803.           CSLIP Compressed  Serial Line IP. A protocol for exchanging IP pack-
  23804.                 ets over a serial  line,  using  header  compression  of  most
  23805.                 TCP/IP datagrams.
  23806.  
  23807.  
  23808.             DNS Domain name system. This is a distributed database used on the
  23809.                 Internet for mapping of host names to IP addresses.
  23810.  
  23811.  
  23812.             EGP External Gateway Protocol. A protocol for  exchanging  routing
  23813.                 information between autonomous systems.
  23814.  
  23815.  
  23816.        Ethernet In  colloquial terms, the name of a sort of network equipment.
  23817.                 Technically, Ethernet is part of a set of standards set  forth
  23818.                 by  the  IEEE.  The  Ethernet  hardware uses a single piece of
  23819.                 cable, frequently coax cable, to connect a  number  of  hosts,
  23820.                 and allows transfer rates of up to 10Mbps. The Ethernet proto-
  23821.                 col defines the manner in which  hosts  may  communicate  over
  23822.                 this cable.(2)
  23823.  
  23824.  
  23825.       
  23826.  
  23827.       2. As  an  aside,  the  Ethernet  protocol  commonly used by
  23828.          TCP/IP is not exactly the same as  IEEE  802.3.  Ethernet
  23829.          frames  have  a type field where IEEE 802.3 frames have a
  23830.          length field.
  23831.  
  23832.  
  23833.  
  23834.  
  23835.  
  23836.  
  23837.  
  23838.                                  - 361 -
  23839.  
  23840.  
  23841.  
  23842.            FQDN Fully Qualified Domain Name. A hostname  with  a  domain  name
  23843.                 tacked  onto  it,  so that it is a valid index into the Domain
  23844.                 Name database.
  23845.  
  23846.  
  23847.             FTP File Transfer Protocol. The protocol  one  of  the  best-known
  23848.                 file transfer service is based on and named after.
  23849.  
  23850.  
  23851.             FYI ``For  Your  Information.''  Series of documents with informal
  23852.                 information on Internet topics.
  23853.  
  23854.  
  23855.             GMU Groucho Marx University.  Fictitious  University  used  as  an
  23856.                 example throughout this book.
  23857.  
  23858.  
  23859.             GNU GNU's not Unix -- this recursive acronym is the name of a pro-
  23860.                 ject by the Free Software Association to  provide  a  coherent
  23861.                 set  of Un*x-tools that may be used and copied free of charge.
  23862.                 All GNU software is covered by  a  special  Copyright  notice,
  23863.                 also called the GNU General Public License (GPL), or Copyleft.
  23864.                 The GPL is reproduced in section 20.3.
  23865.  
  23866.  
  23867.       HoneyDanBer The name of a UUCP variety. See also BNU.
  23868.  
  23869.  
  23870.            host Generally, a network node: something that is able  to  receive
  23871.                 and  transmit  network  messages.  This will usually be a com-
  23872.                 puter, but you can also think of X-Terminals, or smart  print-
  23873.                 ers.
  23874.  
  23875.  
  23876.            ICMP Internet  Control Message Protocol. A networking protocol used
  23877.                 by IP to return error information to the sending host, etc.
  23878.  
  23879.  
  23880.            IEEE Institute of  Electrical  and  Eletronics  Engineers.  Another
  23881.                 standards  organization.  From  a  UNIX  user's point of view,
  23882.                 their most important achievement are probably the POSIX  stan-
  23883.                 dards  which  define  aspects  of a UNIX systems, ranging from
  23884.                 system call interfaces and semantics to administration  tools.
  23885.  
  23886.  
  23887.                      Apart  from  this,  the IEEE developed the specifications
  23888.                 for Ethernet, Token Ring, and Token Bus  networks.  A  widely-
  23889.                 used  standard  for  binary  representation of real numbers is
  23890.                 also due to the IEEE.
  23891.  
  23892.  
  23893.            IETF Internet Engineering Task Force.
  23894.  
  23895.  
  23896.  
  23897.  
  23898.  
  23899.  
  23900.  
  23901.  
  23902.  
  23903.  
  23904.                                  - 362 -
  23905.  
  23906.  
  23907.  
  23908.        internet A computer  network  formed  of  a  collection  of  individual
  23909.                 smaller networks.
  23910.  
  23911.  
  23912.        Internet A particular world-wide internet.
  23913.  
  23914.  
  23915.              IP Internet Protocol. A networking protocol.
  23916.  
  23917.  
  23918.             ISO International Standards Organization.
  23919.  
  23920.  
  23921.            ISDN Integrated  Services  Digital  Network. New telecommunications
  23922.                 technology using digital instead of analogue circuitry.
  23923.  
  23924.  
  23925.             LAN Local Area Network. A small computer network.
  23926.  
  23927.  
  23928.              MX Mail Exchanger. A DNS resource record type used for marking  a
  23929.                 host as mail gateway for a domain.
  23930.  
  23931.  
  23932.       network, packet-switched A  variety  of  networks that provide instanta-
  23933.                 neous forwarding of data by all  data  up  in  small  packets,
  23934.                 which  are  tramsported  to  their  destination  individually.
  23935.                 Packet-switched networks rely on permanent  or  semi-permanent
  23936.                 connections.
  23937.  
  23938.  
  23939.       network, store-and-forward They  are pretty much the opposite of packet-
  23940.                 switched networks.  These networks  transfer  data  as  entire
  23941.                 files,  and  don't  use  permanent connections. Instead, hosts
  23942.                 conect to each other at certain intervals only,  and  transfer
  23943.                 all  data at once.  This requires that data be stored interme-
  23944.                 diately until a connection is established.
  23945.  
  23946.  
  23947.             NFS Network File System. A standard networking protocol and  soft-
  23948.                 ware suite for accessing data on remote disks transparently.
  23949.  
  23950.  
  23951.             NIS Network  Information  System.  An  RPC-based  application that
  23952.                 allows to share configuration files such as the password  file
  23953.                 between several hosts. See also the entry under YP.
  23954.  
  23955.  
  23956.            NNTP Network News Transfer Protocol. Used to transfer news over TCP
  23957.                 network connections.
  23958.  
  23959.  
  23960.           octet On the Internet, the technical term referring to a quantity of
  23961.                 eight  bits.  It  is  used rather than byte, because there are
  23962.  
  23963.  
  23964.  
  23965.  
  23966.  
  23967.  
  23968.  
  23969.  
  23970.                                  - 363 -
  23971.  
  23972.  
  23973.  
  23974.                 machines on the Internet that have byte sizes other than eight
  23975.                 bits.
  23976.  
  23977.  
  23978.             OSI Open Systems Interconnection. An ISO standard on network soft-
  23979.                 ware.
  23980.  
  23981.  
  23982.            path Often used in UUCP networks as a synonym for route.  Also  see
  23983.                 bang path.
  23984.  
  23985.  
  23986.            PLIP Parallel  Line IP. A protocol for exchanging IP packets over a
  23987.                 parallel line such as a printer port.
  23988.  
  23989.  
  23990.       port, TCP or UDP Ports are TCP's and UDP's abstraction of a service end-
  23991.                 point.  Before a process can provide or access some networking
  23992.                 service, it must claim (bind) a port. Together with the hosts'
  23993.                 IP  addresses,  ports uniquely identify the two peers of a TCP
  23994.                 connection.
  23995.  
  23996.  
  23997.       portmapper The portmapper is the mediator between  the  program  numbers
  23998.                 used  by  RPC  as an identification of individual RPC servers,
  23999.                 and the TCP and UDP port numbers those services are  listening
  24000.                 to.
  24001.  
  24002.  
  24003.             PPP The  point-to-point protocol. PPP is a flexible and fast link-
  24004.                 layer protocol to send various network protocols such as IP or
  24005.                 IPX across a point-to-point connection.  Apart from being used
  24006.                 on serial (modem) links, PPP can also be employed as the link-
  24007.                 level protocol on top of ISDN.
  24008.  
  24009.  
  24010.            RARP Reverse  Address Resolution Protocol. It permits hosts to find
  24011.                 out their IP address at boot time.
  24012.  
  24013.  
  24014.        resolver This is a library responsible  for  mapping  hostnames  to  IP
  24015.                 addresses and vice versa.
  24016.  
  24017.  
  24018.       resource record This  is  the  basic  unit  of  information  in  the DNS
  24019.                 database, commonly abbreviated as RR.  Each record has a  cer-
  24020.                 tain  type and class associated with it, for instance a record
  24021.                 mapping a host name to an IP address has  a  type  of  A  (for
  24022.                 address), and a class of IN (for the Internet Protocol).
  24023.  
  24024.  
  24025.       reverse lookup The  act  of looking up a host's name based on a given IP
  24026.                 address.  Within DNS, this is done by looking up the host's IP
  24027.                 address in the in-addr.arpa domain.
  24028.  
  24029.  
  24030.  
  24031.  
  24032.  
  24033.  
  24034.  
  24035.  
  24036.                                  - 364 -
  24037.  
  24038.  
  24039.  
  24040.             RFC Request  For Comments. Series of documents describing Internet
  24041.                 standards.
  24042.  
  24043.  
  24044.             RIP Routing Information Protocol. This is a routing protocol  used
  24045.                 dynamically adjust routes inside a (small) network.
  24046.  
  24047.  
  24048.           route The  sequence  of  hosts  a piece of information has to travel
  24049.                 from the originating host to the destination host. Finding  an
  24050.                 appropriate route is also called routing.
  24051.  
  24052.  
  24053.       routing daemon In  larger networks, network topology changes are hard to
  24054.                 adapt to manually, so facilities are used to  distribute  cur-
  24055.                 rent  routing  information to the network's member hosts. This
  24056.                 is  called  dynamic  routing;  the  routing   information   is
  24057.                 exchanged  by  routing daemons running on central hosts in the
  24058.                 network.  The protocols they employ are called routing  proto-
  24059.                 cols.
  24060.  
  24061.  
  24062.             RPC Remote Procedure Call. Protocol for executing procdures inside
  24063.                 a process on a remote host.
  24064.  
  24065.  
  24066.              RR Short for resource record.
  24067.  
  24068.  
  24069.          RS-232 This is a very common standard for serial interfaces.
  24070.  
  24071.  
  24072.         RTS/CTS A colloquial name for the hardware handshake performed by  two
  24073.                 devices  communicating  over RS-232. The name derives from the
  24074.                 two  cicuits  involved,  RTS  (``Ready  To  Send''),  and  CTS
  24075.                 (``Clear To Send'').
  24076.  
  24077.  
  24078.       RTM Internet Worm A  Virus-like  program  that used several flaws in VMS
  24079.                 and BSD 4.3 Unix  to  spread  through  the  Internet.  Several
  24080.                 ``mistakes''  in  the  program  caused  it to multiply without
  24081.                 bound, and so effectively bringing down  large  parts  of  the
  24082.                 Internet.   RTM  are the author's initials (Robert T. Morris),
  24083.                 which he left in the program.
  24084.  
  24085.  
  24086.            site An agglomeration of hosts which, to the outside, behave almost
  24087.                 like a single network node. For example, when speaking from an
  24088.                 Internet point of view, one would call a Groucho Marx  Univer-
  24089.                 sity a site, regardless of the complexity of its interior net-
  24090.                 work.
  24091.  
  24092.  
  24093.  
  24094.  
  24095.  
  24096.  
  24097.  
  24098.  
  24099.  
  24100.  
  24101.  
  24102.                                  - 365 -
  24103.  
  24104.  
  24105.  
  24106.            SLIP Serial Line IP. This is a protocol for exchanging  IP  packets
  24107.                 over a serial line, see also CSLIP.
  24108.  
  24109.  
  24110.            SMTP Simple  Mail  Transfer  Protocol. Used for mail transport over
  24111.                 TCP connections, but also for mail  batches  transported  over
  24112.                 UUCP links (batched SMTP).
  24113.  
  24114.  
  24115.             SOA Start of Authority. A DNS resource record type.
  24116.  
  24117.  
  24118.        System V A Un*x flavor.
  24119.  
  24120.  
  24121.             TCP Transmission Control Protocol. A networking protocol.
  24122.  
  24123.  
  24124.          TCP/IP Sloppy  description of the Internet protocol suite as a whole.
  24125.  
  24126.  
  24127.             UDP User Datagram Protocol. A networking protocol.
  24128.  
  24129.  
  24130.            UUCP Unix to Unix Copy.  A suite of network transport commands  for
  24131.                 dial-up networks.
  24132.  
  24133.  
  24134.       Version 2 UUCP An aging UUCP variety.
  24135.  
  24136.  
  24137.       virtual beer Every  Linuxer's  favorite drink. The first mention of vir-
  24138.                 tual beer I remember was in the  release  note  of  the  Linux
  24139.                 0.98.X  kernel,  where Linus listed the ``Oxford Beer Trolls''
  24140.                 in his credits section for sending along some virtual beer.
  24141.  
  24142.  
  24143.       well-known services This term is frequently used to refer to common net-
  24144.                 working services such as telnet and rlogin.  In a more techni-
  24145.                 cal sense, it describes all services that have  been  assigned
  24146.                 an official port number in the ``Assigned Numbers'' RFC.
  24147.  
  24148.  
  24149.              YP Yellow  Pages.  An older name for NIS which is no longer used,
  24150.                 because Yellow Pages is a trademark of British Telecom.   Nev-
  24151.                 ertheless,  most NIS utilities have retained names with a pre-
  24152.                 fix of yp.
  24153.  
  24154.  
  24155.  
  24156.  
  24157.  
  24158.  
  24159.  
  24160.  
  24161.  
  24162.  
  24163.  
  24164.  
  24165.  
  24166.  
  24167.  
  24168.                                  - 366 -
  24169.  
  24170.  
  24171.  
  24172.       Annotated Bibliography
  24173.  
  24174.       Books
  24175.  
  24176.       The following is a list of books you might want to read to if  you  want
  24177.       to  know  more about some of the topics covered in the Networking Guide.
  24178.       It is not very complete or systematic, I just happen to have  read  them
  24179.       and  find  them  quite useful. Any additions to, and enhancement of this
  24180.       list are welcome.
  24181.  
  24182.  
  24183.       General Books on the Internet
  24184.  
  24185.  
  24186.  
  24187.       [Kehoe92] Brendan P. Kehoe: Zen and the Art of the Internet. .
  24188.  
  24189.  
  24190.                      ``Zen'' was one of, if  not  the  first  Internet  Guide,
  24191.                 introducing  the  novice  user to the various trades, services
  24192.                 and the folklore of the Internet. Being a  100-page  tome,  it
  24193.                 covered topics ranging from email to Usenet news to the Inter-
  24194.                 net Worm.  It is available via anonymous  FTP  from  many  FTP
  24195.                 servers,  and may be freely distributed and printed. A printed
  24196.                 copy is also available from Prentice-Hall.
  24197.  
  24198.  
  24199.  
  24200.  
  24201.  
  24202.       Administration Issues
  24203.  
  24204.  
  24205.  
  24206.        [Hunt92] Craig Hunt: TCP/IP Network Administration. O'Reilly and  Asso-
  24207.                 ciates, 1992.  ISBN 0-937175-82-X.  Appr. Price .
  24208.  
  24209.  
  24210.                      If  the Linux Network Administrators' Guide is not enough
  24211.                 for you, get this book. It deals with everything from  obtain-
  24212.                 ing  an IP address to troubleshooting your network to security
  24213.                 issues.
  24214.  
  24215.  
  24216.                      Its focus is on setting up  TCP/IP,  that  is,  interface
  24217.                 configuration,  the setup of routing, and name resolution.  It
  24218.                 includes a detailed description of the facilities  offered  by
  24219.                 the  routing  daemons  routed  and gated, which supply dynamic
  24220.                 routing.
  24221.  
  24222.  
  24223.                      It also describes the configuration of  application  pro-
  24224.                 grams and network daemons, such as inetd, the r commands, NIS,
  24225.                 and NFS.
  24226.  
  24227.  
  24228.  
  24229.  
  24230.  
  24231.  
  24232.  
  24233.  
  24234.                                  - 367 -
  24235.  
  24236.  
  24237.  
  24238.                      The appendix has  a  detailed  reference  of  gated,  and
  24239.                 named, and a description of Berkeley's sendmail configuration.
  24240.  
  24241.  
  24242.  
  24243.  
  24244.  
  24245.       [Stern92] Hal Stern: Managing NIS  and  NFS.  O'Reilly  and  Associates,
  24246.                 1992.  ISBN 0-937175-75-7.  Appr. Price .
  24247.  
  24248.  
  24249.                      This is a companion book to Craig Hunt's ``TCP/IP Network
  24250.                 Administration'' book. It covers the use of NIS,  the  Network
  24251.                 Information  System,  and  NFS,  the  Network  File System, in
  24252.                 extenso, including the configuration of  an  automounter,  and
  24253.                 PC/NFS.
  24254.  
  24255.  
  24256.  
  24257.  
  24258.  
  24259.       [OReilly89] Tim  O'Reilly  and  Grace  Todino: Managing UUCP and Usenet,
  24260.                 10th ed. O'Reilly and Associates,  1992.   ISBN  0-93717593-5.
  24261.                 Appr. Price .
  24262.  
  24263.  
  24264.                      This  is  the standard book on UUCP networking. It covers
  24265.                 Version 2 UUCP as well as BNU. It helps you  to  set  up  your
  24266.                 UUCP  node from the start, giving practical tips and solutions
  24267.                 for many problems, like testing  the  connection,  or  writing
  24268.                 good chat scripts. It also deals with more exotic topics, like
  24269.                 how to set up a travelling UUCP node, or the  subtleties  pre-
  24270.                 sent in different flavors of UUCP.
  24271.  
  24272.  
  24273.                      The second part of the book deals with Usenet and netnews
  24274.                 software.  It explains the configuration of both  Bnews  (ver-
  24275.                 sion  2.11)  and C news, and introduces you to netnews mainte-
  24276.                 nance tasks.
  24277.  
  24278.  
  24279.  
  24280.  
  24281.  
  24282.        [Spaf93] Gene Spafford and Simson Garfinkel: Practical  UNIX  Security.
  24283.                 O'Reilly  and  Associates,  1992.   ISBN 0-937175-72-2.  Appr.
  24284.                 Price .
  24285.  
  24286.  
  24287.                      This is a must-have for everyone  who  manages  a  system
  24288.                 with  network  access,  and for others as well.  The book dis-
  24289.                 cusses all issues relevant to computer security,  ranging  the
  24290.                 basic   security   features  Un*x  offers  physical  security.
  24291.                 Although you should strive to secure all parts of your system,
  24292.  
  24293.  
  24294.  
  24295.  
  24296.  
  24297.  
  24298.  
  24299.  
  24300.                                  - 368 -
  24301.  
  24302.  
  24303.  
  24304.                 the  discussion of networks and security is the most interest-
  24305.                 ing part of the book in our context. Apart from basic security
  24306.                 policies  that  concern the Berkeley services (telnet, rlogin,
  24307.                 etc), NFS and NIS, it also deals with enhanced  security  fea-
  24308.                 tures  like  MIT's  Kerberos, Sun's Secure RPC, and the use of
  24309.                 firewalls to shield your network from attacks from the  Inter-
  24310.                 net.
  24311.  
  24312.  
  24313.  
  24314.  
  24315.  
  24316.  
  24317.  
  24318.       [AlbitzLiu92] Paul  Albitz  and  Cricket Liu: DNS and BIND. O'Reilly and
  24319.                 Associates, 1992.  ISBN 1-56592-010-4.  Appr. Price .
  24320.  
  24321.  
  24322.                      This book is useful for all those that have to manage DNS
  24323.                 name service.  It explains all features of DNS in great detail
  24324.                 and give examples that make even those BIND options  plausible
  24325.                 that  appear  outright weird at first sight. I found it fun to
  24326.                 read, and really learned a lot from it.
  24327.  
  24328.  
  24329.  
  24330.  
  24331.  
  24332.       [NISPlus] Rick Ramsey:  All  about  Administering  NIS+.  Prentice-Hall,
  24333.                 1993.  ISBN 0-13-068800-2.  Appr. Price .
  24334.  
  24335.  
  24336.  
  24337.  
  24338.  
  24339.       The Background
  24340.  
  24341.       The following is a list of books that might be of interest to people who
  24342.       want to know more about how TCP/IP and its applications work, but  don't
  24343.       want to read RFCs.
  24344.  
  24345.  
  24346.  
  24347.  
  24348.       [Stevens90] Richard  W. Stevens: UNIX Network Programming. Prentice-Hall
  24349.                 International, 1990.  ISBN 0-13-949876-X.  Appr. Price .
  24350.  
  24351.  
  24352.                      This is probably the most widely used book on TCP/IP net-
  24353.                 work  programming,  which,  at  the same time, tells you a lot
  24354.                 about the nuts and bolts of the Internet Protocols.(1)
  24355.  
  24356.  
  24357.  
  24358.  
  24359.  
  24360.       [Tanen89] Andrew S. Tanenbaum: Computer Networks. Prentice-Hall Interna-
  24361.                 tional, 1989.  ISBN 0-13-166836-6(2) .  Appr. Price .
  24362.  
  24363.  
  24364.  
  24365.  
  24366.                                  - 369 -
  24367.  
  24368.  
  24369.  
  24370.                      This book gives you a very good insight into general net-
  24371.                 working issues. Using the OSI Reference Model, it explains the
  24372.                 design  issues  of  each layer, and the algorithms that may be
  24373.                 used to achieve these. At each layer, the  implementations  of
  24374.                 several networks, among them the ARPAnet, are compared to each
  24375.                 other.
  24376.  
  24377.  
  24378.                      The only drawback this  book  has  is  the  abundance  of
  24379.                 abbreviations,  which  sometimes  makes it hard to follow what
  24380.                 the author says.  But this is probably inherent to networking.
  24381.  
  24382.  
  24383.  
  24384.  
  24385.  
  24386.       [Comer88] Douglas  R.  Comer:  Internetworking  with TCP/IP: Principles,
  24387.                 Protocols,  and  Architecture.  Prentice-Hall   International,
  24388.                 1988.
  24389.  
  24390.  
  24391.  
  24392.  
  24393.  
  24394.       HOWTOs
  24395.  
  24396.       The  following  is  an excerpt of the HOWTO-INDEX, version 2.0 (17 March
  24397.       1994), written by Matt Welsh.
  24398.  
  24399.  
  24400.       What are Linux HOWTOs?
  24401.  
  24402.       Linux HOWTOs are short online documents which describe in detail a  cer-
  24403.       tain aspect of configuring or using the Linux system. For example, there
  24404.       is the Installation HOWTO, which gives instructions on installing Linux,
  24405.       and  the  Mail  HOWTO,  which describes how to set up and configure mail
  24406.       under Linux.  Other examples include  the  NET-2-HOWTO  (previously  the
  24407.       NET-2-FAQ) and the Printing HOWTO.
  24408.  
  24409.  
  24410.            Information  in HOWTOs is generally more detailed and in-depth than
  24411.       what can be squeezed into the Linux FAQ. For this reason, the Linux  FAQ
  24412.       is  being rewritten. A large amount of the information contained therein
  24413.       will be relegated to various HOWTO documents.  The FAQ will be a shorter
  24414.       list  of frequently asked questions about Linux, covering small specific
  24415.       topics. Most of the ``useful'' information in the FAQ will now  be  cov-
  24416.       ered in the HOWTOs.
  24417.  
  24418.  
  24419.            HOWTOs are comprehensive documents---much like an FAQ but generally
  24420.       not in question-and-answer format. However, many HOWTOs contain  an  FAQ
  24421.  
  24422.       
  24423.  
  24424.       2. The ISBN under which it is  available  in  North  America
  24425.          might be different.
  24426.  
  24427.  
  24428.  
  24429.  
  24430.  
  24431.  
  24432.  
  24433.                                  - 370 -
  24434.  
  24435.  
  24436.  
  24437.       section  at  the end. For example, the NET-2-FAQ has been renamed to the
  24438.       NET-2-HOWTO, because it wasn't in question-and-answer  format.  However,
  24439.       you will see the NET-2-HOWTO named as the NET-2-FAQ in many places.  The
  24440.       two docs are one and the same.
  24441.  
  24442.  
  24443.       Where to get Linux HOWTOs
  24444.  
  24445.       HOWTOs can be retrieved via anonymous FTP from the following sites:
  24446.  
  24447.  
  24448.  
  24449.  
  24450.               + sunsite.unc.edu:/pub/Linux/docs/HOWTO
  24451.  
  24452.  
  24453.               + tsx-11.mit.edu:/pub/linux/docs/HOWTO
  24454.  
  24455.  
  24456.  
  24457.            as well as the many mirror sites, which are  listed  in  the  Linux
  24458.       META-FAQ (see below).
  24459.  
  24460.  
  24461.            The Index, printed below, lists the currently available HOWTOs.
  24462.  
  24463.  
  24464.            HOWTOs  are  also  posted regularly to the newsgroups comp.os.linux
  24465.       and comp.os.linux.announce. In addition, a number of the HOWTOs will  be
  24466.       crossposted  to  news.answers.  Therefore, you can find the Linux HOWTOs
  24467.       on the news.answers archive site rtfm.mit.edu.
  24468.  
  24469.  
  24470.       HOWTO Index
  24471.  
  24472.       The following Linux HOWTOs are currently available.
  24473.  
  24474.  
  24475.  
  24476.  
  24477.               + Linux Busmouse HOWTO, by mike@starbug.apana.org.au (Mike  Bat-
  24478.                 tersby).  Information on bus mouse compatibility with Linux.
  24479.  
  24480.  
  24481.               + Linux  CDROM  HOWTO, by tranter@software.mitel.com (Jeff Tran-
  24482.                 ter).  Information on CD-ROM drive compatibility for Linux.
  24483.  
  24484.  
  24485.               + Linux DOSEMU HOWTO, by deisher@enws125.EAS.ASU.EDU (Michael E.
  24486.                 Deisher).  HOWTO about the Linux MS-DOS Emulator, DOSEMU.
  24487.  
  24488.  
  24489.               + Linux Distribution HOWTO, by mdw@sunsite.unc.edu (Matt Welsh).
  24490.                 A list  of  mail  order  distributions  and  other  commercial
  24491.  
  24492.  
  24493.  
  24494.  
  24495.  
  24496.  
  24497.  
  24498.  
  24499.                                  - 371 -
  24500.  
  24501.  
  24502.  
  24503.                 services.
  24504.  
  24505.  
  24506.               + Linux      Ethernet      HOWTO,      by     Paul     Gortmaker
  24507.                 gpg109@rsphysse.anu.edu.au.  Information on Ethernet  hardware
  24508.                 compatibility for Linux.
  24509.  
  24510.  
  24511.               + Linux  Ftape  HOWTO,  by  ftape@mic.dth.dk  (Linux ftape-HOWTO
  24512.                 maintainer).  Information on ftape  drive  compatibility  with
  24513.                 Linux.
  24514.  
  24515.  
  24516.               + Linux HOWTO Index, by mdw@sunsite.unc.edu (Matt Welsh).  Index
  24517.                 of HOWTO documents about Linux.
  24518.  
  24519.  
  24520.               + Linux  Hardware  Compatibility  HOWTO,  by  erc@apple.com  (Ed
  24521.                 Carp).   A  near-extensive list of hardware known to work with
  24522.                 Linux.
  24523.  
  24524.  
  24525.               + Linux Installation HOWTO, by mdw@sunsite.unc.edu (Matt Welsh).
  24526.                 How to obtain and install the Linux software.
  24527.  
  24528.  
  24529.               + Linux        JE-HOWTO,        by       Yasuhiro       Yamazaki
  24530.                 hiro@rainbow.physics.utoronto.ca.  Information on JE, a set of
  24531.                 Japanese language extensions for Linux.
  24532.  
  24533.  
  24534.               + Linux  Keystroke  HOWTO,  by Zenon Fortuna (zenon@netcom.com).
  24535.                 HOWTO bind macro actions to keystrokes under Linux.
  24536.  
  24537.  
  24538.               + Linux  MGR  HOWTO,  by  broman@Np.nosc.mil  (Vincent  Broman).
  24539.                 Information on the MGR graphics interface for Linux.
  24540.  
  24541.  
  24542.               + Linux  Electronic  Mail HOWTO, by vince@victrola.wa.com (Vince
  24543.                 Skahan).  Information on Linux-based mail servers and clients.
  24544.  
  24545.  
  24546.               + Linux  NET-2  HOWTO,  by terryd@extro.ucc.su.oz.au (Terry Daw-
  24547.                 son).  HOWTO configure TCP/IP networking, SLIP, PLIP, and  PPP
  24548.                 under Linux.
  24549.  
  24550.  
  24551.               + Linux  News  HOWTO,  by  vince@victrola.wa.com (Vince Skahan).
  24552.                 Information on USENET news  server  and  client  software  for
  24553.                 Linux.
  24554.  
  24555.  
  24556.  
  24557.  
  24558.  
  24559.  
  24560.  
  24561.  
  24562.  
  24563.  
  24564.  
  24565.                                  - 372 -
  24566.  
  24567.  
  24568.  
  24569.               + Linux         PCI-HOWTO,         by        Michael        Will
  24570.                 michaelw@desaster.student.uni-tuebingen.de.   Information   on
  24571.                 PCI-architecture compatibility with Linux.
  24572.  
  24573.  
  24574.               + Linux  Printing HOWTO, by gtaylor@cs.tufts.edu (Grant Taylor).
  24575.                 HOWTO on printing software for Linux.
  24576.  
  24577.  
  24578.               + Linux      SCSI      HOWTO,       by       Drew       Eckhardt
  24579.                 drew@kinglear.cs.Colorado.EDU.   Information  on  SCSI  driver
  24580.                 compatibility with Linux.
  24581.  
  24582.  
  24583.               + Linux Serial HOWTO,  by  gregh@cc.gatech.edu  (Greg  Hankins).
  24584.                 Information  on use of serial devices and communications soft-
  24585.                 ware.
  24586.  
  24587.  
  24588.               + Linux Sound HOWTO, by tranter@software.mitel.com  (Jeff  Tran-
  24589.                 ter).   Sound  hardware  and  software for the Linux operating
  24590.                 system.
  24591.  
  24592.  
  24593.               + Linux Term  HOWTO,  by  Bill  Reynolds  bill@goshawk.lanl.gov.
  24594.                 HOWTO  use the `term' communications package on Linux systems.
  24595.  
  24596.  
  24597.               + Linux Tips HOWTO, by Vince Reed reedv@rpi.edu.  HOWTO on  mis-
  24598.                 cellaneous tips and tricks for Linux.
  24599.  
  24600.  
  24601.               + Linux  UUCP  HOWTO,  by  vince@victrola.wa.com (Vince Skahan).
  24602.                 Information on UUCP software for Linux.
  24603.  
  24604.  
  24605.               + Linux XFree86 HOWTO, by geyer@polyhymnia.iwr.uni-heidelberg.de
  24606.                 (Helmut  Geyer).  HOWTO on installation of XFree86 (X11R5) for
  24607.                 Linux.
  24608.  
  24609.  
  24610.  
  24611.       Miscellaneous and Legalese
  24612.  
  24613.       If you have questions, please feel  free  to  mail  mdw@sunsite.unc.edu.
  24614.       The  Linux  FAQ  rewrite  is  being  coordinated  by Ian Jackson, ijack-
  24615.       son@nyx.cs.du.edu, with help from others.
  24616.  
  24617.  
  24618.            Unless otherwise stated, Linux HOWTO documents are  copyrighted  by
  24619.       their  respective  authors.  Linux HOWTO documents may be reproduced and
  24620.       distributed in whole or in part, in any medium physical  or  electronic,
  24621.       without  permission of the author. Translations and derivative works are
  24622.       similarly   permitted    without    express    permission.    Commercial
  24623.  
  24624.  
  24625.  
  24626.  
  24627.  
  24628.  
  24629.  
  24630.  
  24631.                                  - 373 -
  24632.  
  24633.  
  24634.  
  24635.       redistribution is allowed and encouraged; however, the author would like
  24636.       to be notified of any such distributions.
  24637.  
  24638.  
  24639.            In short, we wish to  promote  dissemination  of  this  information
  24640.       through  as  many  channels  as  possible. However, we do wish to retain
  24641.       copyright on the HOWTO documents, and would like to be notified  of  any
  24642.       plans  to redistribute the HOWTOs. If you have questions, please contact
  24643.       Matt Welsh, the Linux HOWTO coordinator, at mdw@sunsite.unc.edu.
  24644.  
  24645.  
  24646.       RFCs
  24647.  
  24648.       The following is a list of RFCs mentioned  throughout  this  book.   All
  24649.       RFCs  are  available via anonymous FTP from nic.ddn.mil, ftp.uu.net.  To
  24650.       obtain an RFC via email, send a message to service@nic.ddn.mil,  putting
  24651.       the request send RFC-number.TXT in the subject header line.
  24652.  
  24653.  
  24654.  
  24655.  
  24656.            1340 Assigned  Numbers,  Postel, J., and Reynolds, J.  The Assigned
  24657.                 Numbers RFC defines the meaning of  numbers  used  in  various
  24658.                 protocols,  such  as  the  port  numbers  standard TCP and UDP
  24659.                 servers are known to listen on, and the protocol numbers  used
  24660.                 in the IP datagram header.
  24661.  
  24662.  
  24663.            1144 Compressing  TCP/IP headers for low-speed serial links, Jacob-
  24664.                 son, V.  This document describes the algorithm  used  to  com-
  24665.                 press  TCP/IP headers in CSLIP and PPP.  Very worthwhile read-
  24666.                 ing!
  24667.  
  24668.  
  24669.            1033 Domain Administrators Operations Guide, Lottor,  M.   Together
  24670.                 with  its  companion  RFCs, RFC 1034 and RFC 1035, this is the
  24671.                 definitive source on DNS, the Domain Name System.
  24672.  
  24673.  
  24674.            1034 Domain Names - Concepts and Facilities, Mockapetris,  P.V.   A
  24675.                 companion to RFC 1033.
  24676.  
  24677.  
  24678.            1035 Domain  names - Implementation and Specification, Mockapetris,
  24679.                 P.V.  A companion to RFC 1033.
  24680.  
  24681.  
  24682.             974 Mail Routing and the Domain System, Partridge,  C.   This  RFC
  24683.                 describes  mail  routing  on  the Internet.  Read this for the
  24684.                 full story about MX records...
  24685.  
  24686.  
  24687.             977 Network News Transfer Protocol, Kantor, B.,  and  Lapsley,  P.
  24688.                 The  definition of NNTP, the common news transport used on the
  24689.  
  24690.  
  24691.  
  24692.  
  24693.  
  24694.  
  24695.  
  24696.  
  24697.                                  - 374 -
  24698.  
  24699.  
  24700.  
  24701.                 Internet.
  24702.  
  24703.  
  24704.            1094 NFS: Network File System Protocol specification,  Nowicki,  B.
  24705.                 The  formal specification of the NFS and mount protocols (ver-
  24706.                 sion 2).
  24707.  
  24708.  
  24709.            1055 Nonstandard for  Transmission  of  IP  Datagrams  over  Serial
  24710.                 Lines:  SLIP,  Romkey,  J.L.   Describes SLIP, the Serial Line
  24711.                 Internet Protocol.
  24712.  
  24713.  
  24714.            1057 RPC: Remote Procedure Call Protocol Specification: Version  2,
  24715.                 Sun Microsystems, Inc
  24716.  
  24717.  
  24718.            1058 Routing  Information  Protocol,  Hedrick, C.L.  Describes RIP,
  24719.                 which is used to exchange dynamic routing  information  within
  24720.                 LANs and MANs.
  24721.  
  24722.  
  24723.             821 Simple Mail Transfer Protocol, Postel, J.B.  Defines SMTP, the
  24724.                 mail transport protocol over TCP/IP.
  24725.  
  24726.  
  24727.            1036 Standard for the Interchange of USENET  messages,  Adams,  R.,
  24728.                 and Horton, M.R.  This RFC describes the format of Usenet News
  24729.                 messages, and how they are exchanged on the Internet  as  well
  24730.                 as  on UUCP networks. A revision of this RFC is expected to be
  24731.                 released sometime soon.
  24732.  
  24733.  
  24734.             822 Standard for  the  Format  of  ARPA  Internet  text  messages,
  24735.                 Crocker,  D.   This is the definitive source of wisdom regard-
  24736.                 ing, well, RFC-conformant mail. Everyone knows  it,  few  have
  24737.                 really read it.
  24738.  
  24739.  
  24740.             968 Twas  the Night Before Start-up, Cerf, V.  Who says the heroes
  24741.                 of networking remain unsung?
  24742.  
  24743.  
  24744.  
  24745.  
  24746.  
  24747.  
  24748.                                           Index
  24749.  
  24750.  
  24751.  
  24752.                                 /proc/net, 77.
  24753.                                 16450 UART, 74.
  24754.                 Symbols         16550 UART, 74.
  24755.  
  24756.  
  24757.  
  24758.  
  24759.  
  24760.  
  24761.  
  24762.  
  24763.                            - 375 -
  24764.  
  24765.  
  24766.  
  24767. 8250 UART, 74.                    and rcommands, 162.
  24768.                                   with NNTP, 332.
  24769.                                   with PPP, 135, 148-152.
  24770.                                 auto-IRQ, 68.
  24771.                                 automounter, 189.
  24772.              A                  autoprobing fails, 67.
  24773.                                 autoprobing, Ethernet, 67.
  24774.                                 avoid  mail  routing  loops,
  24775. A (DNS record), 114.            257.
  24776. access                          avoid tinygrams, 63.
  24777.   granting, 126, 134, 187.      AX.25, 24, 65.
  24778.   NNTP, 330, 332.
  24779.   PPP, 147.
  24780.   restrict, 188.
  24781.   restricting, 33, 150, 156.
  24782.   UUCP, 214-221.                             B
  24783. access network hardware, see
  24784. interface36.
  24785. acessing                        Barber, Stan, 329.
  24786.   remote files, 183.            Basic  Networking Utilities,
  24787. address                         see UUCP,HDB191.
  24788.   bang path, 235, 238.          batching
  24789.   broadcast, 38, 86, 95.          mail, 234.
  24790.   choosing (IP), 80.              news, 301, 313-316.
  24791.   DNS resource record,  114.    Baud rate, 72.
  24792.   Ethernet, 23.                 BBS, 71.
  24793.   hybrid, 235.                  Becker, Donald, 65.
  24794.   IP, 25.                       Berkeley    Internet    Name
  24795.   mail, 235-236.                Domain, 103.
  24796.   mapping  to hostnames, 52.    BIND, 103, 107-122.
  24797.   negotiation with PPP, 137,    Biro, Ross, 29.
  24798. 143, 150.                       Bit rate, 72.
  24799.   route-addr, 236.              BNC connector, 23, 65.
  24800.   UUCP hostname, 200.           BNU, see UUCP, HDB191.
  24801. Address Resolution Protocol,    BOOTP, 39.
  24802. see ARP38.                      bootup sequence, 77.
  24803. alias                           bounce mail, 234.
  24804.   and C News, 308.              Brewery, Virtual, 79.
  24805.   hostname, 52, 114.            broadcast address, 95.
  24806.   mail, 263.                    BSD socket library, 29.
  24807. aliases, 263-264.               BSMTP, 234.
  24808. Allman, Eric, 230.              bulletin board, 71.
  24809. amateur radio, 24.
  24810. amd, 189.
  24811. anonymous UUCP, 221.
  24812. ARP, 38-39.
  24813.   display table, 100.                        C
  24814.   enabling, 95.
  24815.   proxy, 92, 101, 144.
  24816. ARPANET, 21.                    C News, 298, 303-327.
  24817. assigning IP addresses,  80.      active file, 303, 305-307,
  24818. authoritative  name  server,    311-313.
  24819. 51, 52, 54, 112.                  archiving, 316.
  24820. authorization                     batch parameters, 314-316.
  24821.  
  24822.  
  24823.  
  24824.  
  24825.  
  24826.  
  24827.  
  24828.  
  24829.                            - 376 -
  24830.  
  24831.  
  24832.  
  24833.   batching,  304,  309, 310,    checkgroups  controlmessage,
  24834. 313-316.                        322.
  24835.   compressing batches,  315.    checking
  24836.   create  initial configura-      ARP tables, 100.
  24837. tion, 305.                        Ethernet interface, 100.
  24838.   exchanging news, 308, 310.      host names, 116.
  24839.   excluding sites, 308.           IP routing table, 88.
  24840.   expiring, 316-319.              mail queue, 256.
  24841.   history file, 303, 318.         name server, 116.
  24842.   hostname aliases, 308.          network configuration, 85,
  24843.   ihave/sendme, 309, 314.       88.
  24844.   LAN, 324.                       network connections, 99.
  24845.   limit a feed, 308, 320.         network interface, 84, 98.
  24846.   list   of   currentgroups,      NIS, 172, 174.
  24847. 311, 319.                         NNTP, 333.
  24848.   log files, 320.                 PPP, 142.
  24849.   moderated groups, 319.          reachabilty, 85, 88.
  24850.   newsmaster, 307.                sendmail, 287-291.
  24851.   NNTP support, 309, 333.         smail configuration,  254.
  24852.   receiving  news,  303-304,      TCP server activity, 99.
  24853. 307.                              the routing table, 97.
  24854.   relaynews, 303.                 UUCP, 202.
  24855.   rnews, 310.                   choosing
  24856.   sending     news,     310,      a NIS domain, 169.
  24857. 313-316.                          IP addresses, 80.
  24858.   spool directory, 303.           NIS maps, 174.
  24859.   sys file, 305, 307-311.         UUCP hostname, 200.
  24860.   togo file, 310.               CNAME (DNS record), 114.
  24861.   updateactive file, 322.       collision, Ethernet, 23.
  24862.   update low watermark, 311,    Collyer, Geoff, 298.
  24863. 318, 338.                       COM port, 73.
  24864.   usenet, 307.                  composing mail, 234.
  24865.   UUCP, 304, 315.               Compressed  Serial  Line IP,
  24866. cache (BINDoption), 110.        seeCSLIP26, 124.
  24867. caching-only   name  server,    compressing TCP/IP  packets,
  24868. 123.                            124, 136.
  24869. cancel controlmessage,  321.    configuring
  24870. canonical hostname, 52, 114.      C News, 304-327.
  24871. centralized  mail  handling,      C News on aLAN, 324.
  24872. 237, 239, 242.                    caching-only  name server,
  24873. Challenge  Handshake Authen-    123.
  24874. tication   Protocol,    135,      default domain, 106.
  24875. 148-151.                          dip, 126.
  24876. CHAP,  see  Challenge  Hand-      DNS over SLIP/PPP, 123.
  24877. shake   AuthenticationProto-      elm, 244-246.
  24878. col135.                           Ethernet, 59, 65-69, 86.
  24879. character set in elm, 245.        hostname, 79.
  24880. chargen, 154.                     hostname  resolution,  81,
  24881. chat                            103-122.
  24882.   PPP, 139.                       IP gateway, 90.
  24883.   SLIP, 128.                      IPX, 63.
  24884. chat, 139-141.                    kernel, 59.
  24885. chat script, 139.                 loopback interface, 84.
  24886.   UUCP, 205.                      mail gateway, 251.
  24887.  
  24888.  
  24889.  
  24890.  
  24891.  
  24892.  
  24893.  
  24894.  
  24895.                            - 377 -
  24896.  
  24897.  
  24898.  
  24899.   mail on a LAN, 250-253.         mail, 234-235.
  24900.   name server, 107-122.           news, 301-303.
  24901.   network hardware, 57-70.      Dent, Arthur, 133.
  24902.   network interfaces, 83.       /dev/cua*, 73-74.
  24903.   network services, 154.        /dev/modem, 74.
  24904.   newsreader, 335.              /dev/ttyS*, 73-74.
  24905.   NFS, 61.                      device driver interface, see
  24906.   NIS, 166-180.                 DDI30.
  24907.   NNTP, 328-334.                device, serial, 71-76.
  24908.   PLIP, 59, 69, 70, 90.         dial-up IP, 123.
  24909.   PPP, 59, 92, 135-153.         dialin device, 73.
  24910.   sendmail, 268-297.            dialout device, 73.
  24911.   serial port, 75-76.           dip, 126-134.
  24912.   SLIP, 59, 92, 123-134.        diphosts, 133.
  24913.   SLIP server, 132.             diplogin, 132.
  24914.   smail, see smail247.          directing  mail  to   afile,
  24915.   the rcommands, 162-165.       261.
  24916.   use of name server, 106.      disabling ARP, 95.
  24917.   Usenet news, 304-327.         diskless clients, 39.
  24918.   UUCP, 191-229.                display
  24919.   UUCP mail, 248.                 active connections, 99.
  24920. connecting LANs, 144.             ARP table, 100.
  24921. connections, display, 99.         interface   configuration,
  24922. Cox, Alan, 29.                  93.
  24923. creating                          interface statistics,  98.
  24924.   DNS zones, 55.                  IP  routing table, 88, 97.
  24925.   NIS maps, 172.                  NIS map nicknames, 168.
  24926.   subdomains, 49.                 UUCP configuration, 202.
  24927.   subnets, 54, 80.              DNS, 46-56.
  24928. CSLIP,  26,  124,  125, 133,      checking, 116.
  24929. 136.                              configuring        server,
  24930.                                 107-122.
  24931.                                   converting     /etc/hosts,
  24932.                                 122.
  24933.                                   creating zones, 55.
  24934.              D                    database, 51.
  24935.                                   debugging databases,  122.
  24936.                                   lookup, 49.
  24937. D-Link pocket adaptor, 65.        query, 50.
  24938. Davies, David C., 65.             resource  record, 51, 111.
  24939. Dawson, Terry, 11.                reverse mapping, 52-56.
  24940. daytime, 154.                     root  name  servers,  116,
  24941. DDI, 30.                        120.
  24942. debugging                         RR,   see   DNS,  resource
  24943.   DNS databases, 122.           record51.
  24944.   PPP setup, 142.                 time to live, 50, 111.
  24945.   UUCP setup, 195.                tools, 121.
  24946. default   IP   route,    see      ttl,   see    DNS,    time
  24947. route,default38.                tolive50.
  24948. default mail route, 239.          zone, 49-52, 54, 112.
  24949. delegating                      dnswalk, 122.
  24950.   DNS subdomains, 49, 54.       domain
  24951.   IP subnets, 41.                 mail routing, 239.
  24952. delivering                      domain name, 47-49.
  24953.  
  24954.  
  24955.  
  24956.  
  24957.  
  24958.  
  24959.  
  24960.  
  24961.                            - 378 -
  24962.  
  24963.  
  24964.  
  24965.   default, 106.                 187.
  24966.   NIS vs. DNS, 80.              exports, 187.
  24967.   setting NIS, 169.             External  Data   Representa-
  24968. Domain   Name   System,  see    tion, 161.
  24969. DNS46.
  24970. domainname, 80, 169.
  24971. domains
  24972.   top-level, 47.
  24973. dotted quad, 25, 37.                         F
  24974. driver
  24975.   D-Link, 65.
  24976.   Ethernet, 65.                 Faith, Rik, 8.
  24977.   ISDN, 65.                     FDDI, 24.
  24978.   PLIP, 69.                     feed, news, 300.
  24979.   PPP, 70, 136.                 feeding  mail  to  acommand,
  24980.   SLIP, 70.                     262.
  24981. dummy interface, 92.            FidoNet, 71.
  24982. dynamic routing, 44.            file sharing, 181.
  24983.                                 File System Standard, 16.
  24984.                                 finger, 156.
  24985.                                 Flintstone, Fred, 17.
  24986.                                 flooding algorithm, 300.
  24987.              E                  forwarding
  24988.                                   IP, 25, 62.
  24989.                                   mail, 262, 263.
  24990. Ekwall, Bjrn, 65.                 UUCP, 19.
  24991. electronic mail, 230.           fstab, 78, 184.
  24992. elm, 244-246.                   FTP, location of  Linuxcode,
  24993.   national  character  sets,    31, 78.
  24994. 245.                            full user names, 307.
  24995. email, see mail230.
  24996. enabling ARP, 95.
  24997. Eriksson, Peter, 166.
  24998. establishing the connection,
  24999. 139.                                         G
  25000. eth0    (Ethernetinterface),
  25001. 86.
  25002. Ethernet, 22-24.                gated, 44, 92, 145.
  25003.   address, 23, 38.              gateway, 25, 41-43.
  25004.   address  vs.  IP  address,      configuring, 90.
  25005. 25.                               IP, 89.
  25006.   autoprobing, 67-69.             mail, 237.
  25007.   Becker drivers, 65.           generatinga paths file, 241.
  25008.   cabling, 65.                  getty, 217.
  25009.   collision, 23.                Gortmaker, Paul, 66.
  25010.   configuration, 86.            Groucho Marx University, 21,
  25011.   installation, 65.             41.
  25012.   promiscuous mode, 96.         group.bygid, 176.
  25013.   thin, 23, 65.                 group.byname, 176.
  25014.   through parallel port, 65.
  25015. exchanging
  25016.   mail, 234-235.
  25017.   news, 299, 300.
  25018. exporting   an  NFS  volume,                 H
  25019.  
  25020.  
  25021.  
  25022.  
  25023.  
  25024.  
  25025.  
  25026.  
  25027.                            - 379 -
  25028.  
  25029.  
  25030.  
  25031. ham radio, 24, 38.              ifconfig, 83, 93.
  25032. handshake, hardware, 74, 76,    IMAP, 250.
  25033. 137.                            in-addr.arpa domain, 52.
  25034. Hankins, Greg, 71.              inetd, 154, 162, 253.
  25035. hardware                        inetd.conf, 154-156.
  25036.   handshake, 74, 76, 137.       inews, 303.
  25037.   networking, 57-70.            initializing networking, 77.
  25038.   serial, 71-76.                INN, 299, 329, 336.
  25039. HDB, see UUCP, HDB191.          installing
  25040. HDLC, 135.                        network binaries, 78.
  25041. HoneyDanBer,    see    UUCP,    Interactive Mail Access Pro-
  25042. HDB191.                         tocol, 250.
  25043. host, 17.                       interface, 36, 57, 58, 64.
  25044.   standalone, 92.                 configuration, 83.
  25045. host.conf, 103, 166, 180.         D-Link DE-600, 64.
  25046. hostcvt, 122.                     dummy, 92.
  25047. hostname                          Ethernet, 64, 86.
  25048.   aliases, 114.                   loopback, 64, 84.
  25049.   ambiguous, 238.                 netmask, 40, 80, 86, 94.
  25050.   and domain name, 47.            PLIP, 65, 90.
  25051.   canonical, 52, 114.             PPP, 65, 92, 138.
  25052.   catching unqualified, 266.      SLIP, 65, 92.
  25053.   fully qualified, 47.            statistics, 98.
  25054.   lookup, 49, 116.              internationalization     for
  25055.   mapping to addresses,  46.    elm, 245.
  25056.   obtaining   from  address,    Internet, 21.
  25057. 52.                               connecting  to,  123, 135,
  25058.   resolution, 46,  81,  103,    137.
  25059. 166, 180.                         mail routing, 237.
  25060.   setting, 79.                    vs. internetworking, 25.
  25061.   UUCP, 200.                    Internet   Control   Message
  25062. hosts, 81, 167.                 Protocol, 45.
  25063.   converting to BIND master-    InterNet News (INN), 299.
  25064. files, 122.                     Internet Protocol, see IP24.
  25065. hosts file, 81.                 internetworking, 25, 41.
  25066. hosts.byaddr, 167.              IP, 24-26.
  25067. hosts.byname, 167, 175.           address, 25, 36-38.
  25068. hosts.equiv, 163.                    and hostname, 46, 52.
  25069. HOWTO, 8.                            assigning, 80.
  25070.   Ethernet, 66.                      negotiation   in   PPP,
  25071.   Networking, 11.               137, 143, 150.
  25072.   Serial, 71.                     address  vs. hostname, 25.
  25073.   UUCP, 192.                      broadcast address, 86, 95.
  25074.                                   Control   Protocol,   135,
  25075.                                 142.
  25076.                                   default route, 38, 90.
  25077.                                   dial-up, 123, 135.
  25078.              I                    dynamic routing, 44.
  25079.                                   forwarding, 25, 62.
  25080.                                   gateway, 25, 89, 90.
  25081. ICMP, 45.                         interface, 58.
  25082.   Port Unreachable, 45.           interface   configuration,
  25083.   Redirect, 45.                 83.
  25084. IDA, see sendmail, IDA268.        metric, 44, 95.
  25085.  
  25086.  
  25087.  
  25088.  
  25089.  
  25090.  
  25091.  
  25092.  
  25093.                            - 380 -
  25094.  
  25095.  
  25096.  
  25097.   MTU,  see Maximum Transfer      connecting, 144.
  25098. Unit95.                           hostname  resolution, 180.
  25099.   multicast addresses, 96.        mail, 250.
  25100.   netmask, 40, 80, 86, 94.        news, 324.
  25101.   network, 52.                    passwords, 162, 176,  180.
  25102.   Network  Control  Protocol      r commands, 162.
  25103. (PPP), 135.                     Lapsley, Phil, 329.
  25104.   networks, 36, 39.             Latin-1  character set, 245.
  25105.   parallel line, see PLIP69.    LCP, see Link Control Proto-
  25106.   routing,  25,  39-45,  63,    col(PPP)135.
  25107. 89, 90.                         LDP, see Linux Documentation
  25108.   routing protocols, 44.        Project8.
  25109.   routing table, 43, 88, 97.    leaf site, 239.
  25110.   serial line,  see  SLIP70,    lilo, 67.
  25111. 123, 135.                       line  discipline,  72,  124,
  25112.   sub-networks, see IP, sub-    136.
  25113. net40.                          Link Control Protocol (PPP),
  25114.   subnet, 40-41, 54, 63, 89,    135, 145-147.
  25115. 90.                             Linux Activists, 15.
  25116.   tinygrams, 63.                Linux  DocumentationProject,
  25117. IPCP, see IP, Control Proto-    8, 15.
  25118. col135.                         lmail, 234.
  25119. IPX, 63.                        lo  (loopbackinterface), 84.
  25120. IRQ, 58, 68.                    Local  Area   Network,   see
  25121. ISDN, 65.                       LAN20.
  25122. ISO-8859-1, 245.                localhost, 84.
  25123.                                 lock files
  25124.                                   and PPP, 139.
  25125.                                 looking up addresses, 52.
  25126.                                 loopback
  25127.              J                    address, 38.
  25128.                                   interface, 84.
  25129.                                 looped   back  serial  line,
  25130. Johnson, Michael K., 8.         135.
  25131. junk newsgroup, 303.
  25132.  
  25133.  
  25134.  
  25135.                                              M
  25136.              K
  25137.  
  25138.                                 mail, 230.
  25139. Karr, Ronald S., 230.             address formats,  235-236.
  25140. Kempen, Fred van, 21, 29.         aliases, 263-264.
  25141. kernel  network   configura-      bang  path  address,  235,
  25142. tion, 59.                       238.
  25143.                                   batching, 234.
  25144.                                   bounce, 234, 257, 273.
  25145.                                   centralizing,  237,   239,
  25146.                                 242.
  25147.              L                    composing, 234.
  25148.                                   daemon, 247.
  25149.                                   default route, 239.
  25150. LAN, 20.                          delivering, 234-235.
  25151.  
  25152.  
  25153.  
  25154.  
  25155.  
  25156.  
  25157.  
  25158.  
  25159.                            - 381 -
  25160.  
  25161.  
  25162.  
  25163.   directing  to a file, 261.      the procfilesystem, 77.
  25164.   domain-based routing, 237,    MRU,   see   PPP,    Maximum
  25165. 242.                            ReceiveUnit146.
  25166.   feeding to a command, 262.    mthreads, 337.
  25167.   forcing   UUPC   delivery,    MTU,  see  Maximum  Transfer
  25168. 293.                            Unit95.
  25169.   forwarding, 262, 263.         multi-media mail, 230.
  25170.   gateway, 237.                 MX (DNS record), 115, 237.
  25171.   headers, 231.
  25172.   maps, 238, 242.
  25173.   message format, 231.
  25174.   multi-media, 230.
  25175.   on a LAN, 250.                             N
  25176.   over UUCP, 234.
  25177.   paths  file, 239, 241-243.
  25178.   postmaster, 257.              Nagle's algorithm, 63.
  25179.   preventing UUPC  delivery,    name server, 50-51.
  25180. 294.                              authoritative, 51, 52, 54.
  25181.   queue, 247, 255-256.            cache, 110.
  25182.   route-addr address, 236.        caching-only, 51, 123.
  25183.   routing, 236-241.               checking, 116.
  25184.      between   Internet  and      configuring, 107-122.
  25185. UUCP, 237.                        primary, 51, 109.
  25186.      domain-based, 239.           root, 116, 120.
  25187.      Internet, 237.               secondary, 51, 110.
  25188.      smart-host, 239.             slave, 110.
  25189.      UUCP networks, 238.          synchronizing, 51.
  25190.   site hiding, 250.             name space (DNS), 47.
  25191. Mail Exchanger (DNS record),    named, 103, 107-122.
  25192. 237.                            named.boot, 108-111.
  25193. mailbox file, 262.              national    character   sets
  25194. mailboxes                       inelm, 245.
  25195.   mounting via NFS, 250.        NCP,  see  Network   Control
  25196. maintenance, system, 31.        Protocols135.
  25197. manual configuration (Ether-    Net-1, 29.
  25198. net), 67.                       Net-2d, 29.
  25199. manual configuration (PLIP),    Net-2Debugged, 29.
  25200. 70.                             Net-2e, 30, 31, 78.
  25201. maps, Usenet, 238, 242.         Net-3, 30, 31, 78.
  25202. Marx, Groucho, 21.              Net-BSD, 31, 78.
  25203. Maximum  Receive Unit (PPP),    netstat, 96-100.
  25204. 146.                            network, 17.
  25205. Maximum Transfer  Unit,  94,      booting, 77.
  25206. 95, 102, 146.                     connections,  see network,
  25207. metamail, 245.                  port27.
  25208. metric,  routing,  see rout-      devices, 57.
  25209. ing, metric44.                    display connections, 99.
  25210. mgetty, 217, 219.                 hostname resolution,  180.
  25211. modem, speed, 72.                 interconnecting,       see
  25212. mountd, 186, 187.               internetworking25.
  25213. mounting                          interface,   see    inter-
  25214.   an NFS volume, 183.           face36.
  25215.   automatically, 189.             Internet, 21.
  25216.   readonly, 188.                  kernel options, 59.
  25217.  
  25218.  
  25219.  
  25220.  
  25221.  
  25222.  
  25223.  
  25224.  
  25225.                            - 382 -
  25226.  
  25227.  
  25228.  
  25229.   names, 81.                      pulling, 302, 328.
  25230.   packet-switched, 20.            pushing, 302, 328.
  25231.   passwords, 176, 180.            reader, see newsreader335.
  25232.   port, 27-29.                    receiving, 307.
  25233.   port numbers, 28.               remove old group, 321.
  25234.   programming interface, 29.      spool, 302.
  25235.   protocols, 17.                  update activefile, 322.
  25236.   services, see port28.           Usenet, 299.
  25237.   synchronizing   passwords,    newsmaster, 307.
  25238. 166.                            newsreader
  25239.   TCP/IP, see TCP/IP20.           configuring, 335.
  25240.   unreachable, 86.                creating thread databases,
  25241.   UUCP, see UUCP18.             336-338.
  25242. Network  Control  Protocols,      nn, 338.
  25243. 135.                              tass, 336.
  25244. Network  File  System,   see      threading, 335, 336.
  25245. NFS181.                           tin, 336.
  25246. Network  Information System,      trn, 337.
  25247. see NIS166.                     NFS, 181-190.
  25248. Network News Transfer Proto-      automounter, 189.
  25249. col, seeNNTP298.                  exporting a volume, 187.
  25250. ``NetworkUnreachable'' error      exports, 187.
  25251. message, 86.                      hard-mounting   vs.  soft-
  25252. networks file, 81.              mounting, 185.
  25253. newgroup     controlmessage,      limitations, 182.
  25254. 321.                              matching  uids  and  gids,
  25255. news, 298-302.                  186, 189.
  25256.   active file, 302, 303.          mounting  a  volume,  181,
  25257.   add new group, 321.           183.
  25258.   archiving articles, 316.        readonly volume, 188.
  25259.   article, 299.                   restricting  block   size,
  25260.   batching, 301, 304, 313.      185.
  25261.   C  release, see C News298.      server, 182, 186.
  25262.   cancel article, 321.            timeout, 185.
  25263.   control messages, 321.        nfsd, 182, 186.
  25264.   deleting old news, 302.       NIS, 166-180.
  25265.   distribution, 301.              and shadow passwords, 179.
  25266.   distributions, 308.             and the resolver, 104.
  25267.   exchanging, 299-302.            client, 170-171,  173-180.
  25268.   expiring, 338, 339.             creating maps, 172.
  25269.   expiring   old   articles,      databases, 167.
  25270. 302.                              domain, 169-170.
  25271.   faking, 329.                    locating server, 169.
  25272.   feeding, 299-302.               map, 167-170.
  25273.   flooding algorithm, 300.        nickname, 168.
  25274.   follow-up, 335.                 passwd maps, 176-180.
  25275.   groups, 299.                    server, 169-173.
  25276.   history, 301, 303.              traditional code, 179.
  25277.   ihave/sendme, 301.            NIS+, 170.
  25278.   limit a feed, 301.            nn, 338.
  25279.   message id, 301, 303.         NNTP, 298, 328.
  25280.   newsmaster, 307.                and C News, 333.
  25281.   NNTP, 301.                      authorization, 332.
  25282.   nntpd, 328.                     restricting  access,  330,
  25283.  
  25284.  
  25285.  
  25286.  
  25287.  
  25288.  
  25289.  
  25290.  
  25291.                            - 383 -
  25292.  
  25293.  
  25294.  
  25295. 332.                            PPP26, 135.
  25296. nntp access, 330.               POP, 250.
  25297. nntpd, 329.                     port, see network, port27.
  25298. Noll, Curt Landon, 230.           COM, 73.
  25299. nslookup, 116-121.                numbers, 28.
  25300. nsswitch.conf, 174-176.         portmap, 162.
  25301. NYS, 166-180.                   portmapper daemon, 162.
  25302.                                 portmapper  failure   (error
  25303.                                 message), 179.
  25304.                                 Post Office Protocol, 250.
  25305.                                 PPP, 26, 92, 123, 135-153.
  25306.              O                    and IP addresses, 137.
  25307.                                   async map, 146.
  25308.                                   authentication, 148-152.
  25309. obtaining the  source  code,      chat script, 139-141.
  25310. 31, 78.                           compressing   data,   136,
  25311. order  of  resolver service-    146.
  25312. sused, 104.                       daemon, 136.
  25313.                                   debug information, 142.
  25314.                                   default route, 138.
  25315.                                   driver, 136.
  25316.                                   dynamic  address   assign-
  25317.              P                  ment, 143.
  25318.                                   escaping  control  charac-
  25319.                                 ters, 146.
  25320. Packet                Assem-      IP addresses, 143-144.
  25321. bler/Disassembler, 24.            lock files, 139.
  25322. PAD, 24.                          Maximum Receive Unit, 146.
  25323. PAP,  see Password Authenti-      option files, 138.
  25324. cation Protocol135.               proxy ARP, 144.
  25325. Parallel   Line   IP,    see      routing, 101, 144-145.
  25326. PLIP90.                           security, 147.
  25327. parallel port                     server, 152.
  25328.   Ethernet, 65.                   using CHAP, 148-151.
  25329.   IP, 69.                         using PAP, 148, 151-152.
  25330. passwd, 167.                    pppd, 136-153.
  25331.   real user names, 307.         .ppprc, 138.
  25332. passwd.byname, 176.             prevent spoofing, 104.
  25333. passwd.byuid, 176.              primary (BINDoption), 109.
  25334. Password Authentication Pro-    proc filesystem, 77.
  25335. tocol, 135, 148.                protocol, 17.
  25336. passwords                         AX.25, 24, 65.
  25337.   and remote login, 162.          CSLIP, 26.
  25338.   network-wide, 176-179.          Ethernet, 22.
  25339. pathalias, 239, 243.              IP, see IP24.
  25340. paths file, 239, 241-243.         IPX, 63, 65.
  25341. PC/TCP compatibility, 62.         NNTP, 328.
  25342. ping, 85.                         PPP, 26.
  25343. PLIP, 69, 90.                     SLIP, 26.
  25344.   routing, 101.                   TCP, 26.
  25345. plip1 (PLIPinterface), 90.        UDP, 27.
  25346. point-to-point link, 90, 92,      UUCP, 222.
  25347. 95, 101, 135.                     X.25, 24.
  25348. Point-to-Point Protocol, see    protocol numbers, 160.
  25349.  
  25350.  
  25351.  
  25352.  
  25353.  
  25354.  
  25355.  
  25356.  
  25357.                            - 384 -
  25358.  
  25359.  
  25360.  
  25361. protocols, 155, 159-161.        Protocol, seeRARP38.
  25362. proxy ARP, 92, 101, 144.        reverse mapping, 52-56.
  25363. PTR (DNS record), 114.          .rhosts, 163.
  25364.                                 RIP, see Routing Information
  25365.                                 Protocol44.
  25366.                                 rlogin, 162.
  25367.                                 rmail, 214, 234.
  25368.              Q                  rmgroup controlmessage, 321.
  25369.                                 rnews, 214, 303, 315.
  25370.                                 round-trip time (IP), 85.
  25371. queuing mail, 255.              route, 83, 88, 102.
  25372. Quinlan, Dan, 16.               route, default, 38, 90, 138.
  25373.                                 routed, 44.
  25374.                                 routing
  25375.                                   daemon, 44.
  25376.                                   dynamic,  44, 45, 92, 101,
  25377.              R                  145.
  25378.                                   ICMP Redirect, 45.
  25379.                                   IP  datagrams,   see   IP,
  25380. RARP, 39, 62.                   routing24.
  25381. rc scripts, 77.                   IP gateway, 89.
  25382. rc.inet, 77, 83, 86, 186.         loop avoidance, 257.
  25383. rcp, 162.                         mail, see mail routing236.
  25384. reaching a host, 85.              metric, 44, 94, 95.
  25385. readonly NFS volume, 188.         over PPP, 144.
  25386. real user names, 307.             protocols, 44.
  25387. Reber, Tobias, 166.               proxy ARP, 101.
  25388. receiving news, 307.              smart-host, 239.
  25389. remote                            table, 43, 97.
  25390.   command execution, 162.       Routing  Information  Proto-
  25391.   execution, 18, 234.           col, 44, 92, 95.
  25392.   file access, 19, 162, 181.    RPC,  see  Remote  Procedure
  25393.   file system, 183.             Call161.
  25394.   login, 21, 27, 162.           rpc, 161.
  25395.   X11 session, 22.              rpcinfo, 174.
  25396. Remote    Procedure    Call,    RR,   see   DNS,    resource
  25397. 161-162.                        record51.
  25398.   mapping  portsto programs,    RS-232, 74.
  25399. 162.                            rsh, 162.
  25400.   program numbers, 161.         rsmtp, 234.
  25401. resolv.conf, 106.               RTS/CTS, 74.
  25402. resolver
  25403.   configuring, 103-107.
  25404.   environment     variables,
  25405. 105.
  25406.   library, 103.                              S
  25407.   robustness, 107.
  25408.   using  a name server, 103.
  25409.   using NIS, 103.               Salz, Rich, 329.
  25410. resource  record,  see  DNS,    secondary (BINDoption), 110.
  25411. resourcerecord51.               security, 134.
  25412. restrict rootaccess, 188.         Ethernet, 96.
  25413. restricting access, 156.          false hostnames, 104.
  25414. Reverse  Address  Resolution      PPP, 140, 147-152.
  25415.  
  25416.  
  25417.  
  25418.  
  25419.  
  25420.  
  25421.  
  25422.  
  25423.                            - 385 -
  25424.  
  25425.  
  25426.  
  25427.   r commands, 162.                UUCP, 274, 279, 293,  294.
  25428.   remote login, 162.              UUCP leaf site, 276.
  25429.   SLIP, 126.                      version, 284.
  25430.   spoofing, 104.                  writing   mail  to  afile,
  25431.   system, 32.                   282.
  25432.   TCP servers, 156.             sendmail.cf,      see  send-
  25433.   UUCP, 214-221.                mail, sendmail.cf268.
  25434.   UUCP logins, 219-221.         checkgroups  controlmessage,
  25435. sendbatches, 313.               324.
  25436. sendmail, 230, 268-297.         checkgroups  controlmessage,
  25437.   aliases, 282.                 324.
  25438.   CF, 268-277, 285-286.         serial line
  25439.   DECnet, 283.                    device file, 73.
  25440.   deliver, 272.                   hardware   handshake,  74,
  25441.   file locations, 296.          76.
  25442.   forcing mail, 292.              looped back, 135.
  25443.   forcing   UUPC   delivery,      protecting     characters,
  25444. 293.                            146.
  25445.   fully   qualified   domain      speed, 72.
  25446. name, 279, 281.                 serial  line  IP, see PPP26,
  25447.   generating    sendmail.cf,    see SLIP26.
  25448. 285-286.                        server
  25449.   IDA, 269.                       inetd, 154-159.
  25450.   installing, 284.                tcpd, 156-159.
  25451.   Internet site, 276.             nfsd, 182.
  25452.   local hostnames, 274.           NIS, 169.
  25453.   mailers,  272,  275,  277,      NNTP, 328.
  25454. 279, 281, 293, 294.               sendmail, 286.
  25455.   mailertable, 277.               UUCP, 217-221.
  25456.   postmaster, 282.                ypserv, 169.
  25457.   postmaster, 273.              services, 28.
  25458.   preventing UUPC  delivery,      and port numbers, 28.
  25459. 294.                              restricting  access,   33,
  25460.   queue operation, 295.         156.
  25461.   relay host, 275, 292.           setting up, 154.
  25462.   remote site misconfigured,      well-known, 28, 159.
  25463. 292.                            services, 155, 159-161.
  25464.   routing, 280.                 services.byname, 175.
  25465.      domain, 292.               setserial, 75.
  25466.      smart-host, 275.           setting
  25467.      UUCP,  279,  283,  293,      domain name, 80.
  25468. 294.                              hostname, 79.
  25469.   run the queue, 295.             NIS domain, 169, 173.
  25470.   running, 286.                 Simple  Mail Transfer Proto-
  25471.   sendmail.cf, 268.             col, seeSMTP234.
  25472.   statistics, 295.              site, 17.
  25473.   tables,   269,  276,  283,      leaf, 239.
  25474. 289.                            sl0 (PPPinterface), 92.
  25475.   testing, 287-291.             sl0 (SLIPinterface), 92.
  25476.   transport,  see  sendmail,    slattach, 124.
  25477. mailers272.                     SLIP,  26,   70,   72,   92,
  25478.   unqualified hostname, 279,    123-134.
  25479. 281, 293, 294.                    let users initiate, 126.
  25480.   user aliases, 282, 283.         routing, 101.
  25481.  
  25482.  
  25483.  
  25484.  
  25485.  
  25486.  
  25487.  
  25488.  
  25489.                            - 386 -
  25490.  
  25491.  
  25492.  
  25493. SLIPDISC, 124.                  Start of Authority, 52.
  25494. smail, 230, 247-267.            Storm, Kim F., 338.
  25495.   and SLIP/PPP, 260.            subdomain (DNS), 49, 54.
  25496.   BSMTP, 248, 265.              subnet (DNS), 80.
  25497.   check mail queue, 256.        subnet (IP), 41, 63.
  25498.   compiling, 255.               `Subnets  AreLocal'  Policy,
  25499.   config file, 247-249, 257.    63, 102.
  25500.   delivery modes, 255.          synchronizing name  servers,
  25501.   directing mail  to  afile,    51.
  25502. 261.                            syslog, 142, 158, 189.
  25503.   directors, 258.               system maintenance, 31.
  25504.   feeding  mail to acommand,    system security, 32.
  25505. 262.
  25506.   forwarding, 262.
  25507.   handling mail for adomain,
  25508. 250.
  25509.   local  addresses, 261-265.                 T
  25510.   local hostnames, 248.
  25511.   log files, 253.
  25512.   mailing lists, 264.           T'so, Theodore, 75.
  25513.   on a LAN, 250-253.            tass, 336.
  25514.   paths file, 259, 260.         Taylor, Ian, 191.
  25515.   postmaster, 257.              TCP, 26-27.
  25516.   queuing mail, 255.              UUCP, 212.
  25517.   routers, 258.                   wrapper program, 156.
  25518.   routing, 257-261.             TCP/IP, 20-29, 36-46.
  25519.      avoid loops, 257.          tcpd, 156-159.
  25520.      Internet, 260.             telephone,    sending   data
  25521.      smart-host, 249.           over, 26, 123, 135.
  25522.      UUCP, 259, 260.            terminal programs, 71.
  25523.      UUCP vs. SLIP, 260.        testing  network  configura-
  25524.   run the queue, 256.           tion, 85, 88.
  25525.   SMTP, 252-253, 266.           TFTP,   see   Trivial   File
  25526.   transports, 258.              TransferProtocol156.
  25527.   troubleshooting, 253.         tftp, 156.
  25528.   unqualified     hostnames,    thinnet, 23, 65.
  25529. 266.                            Thmmler, Swen, 166.
  25530.   user aliases, 263-264.        tin, 336.
  25531.   user mailbox, 262.            tinygrams, 63.
  25532.   utilities, 247.               Transmission Control  Proto-
  25533.   UUCP,  248-249,  259, 260,    col, see TCP26.
  25534. 265-266.                        tripwire, 33.
  25535. smart-host routing, 239.        Trivial File Transfer Proto-
  25536. SMTP, 234.                      col, 156.
  25537.   batched, 214, 234.            trn, 337.
  25538.   service, 252.                 tty, 72-76.
  25539. SNARL,    see`Subnets    Are      line discipline, 72,  124,
  25540. Local' Policy63.                136.
  25541. SOA (DNS record), 52, 112.
  25542. socket, 29.
  25543. Space.c, 67, 70.
  25544. Spencer, Henry, 298.
  25545. spoofing, 104.                               U
  25546. standalone host, 92.
  25547.  
  25548.  
  25549.  
  25550.  
  25551.  
  25552.  
  25553.  
  25554.  
  25555.                            - 387 -
  25556.  
  25557.  
  25558.  
  25559. UART, 74.                            selection, 225.
  25560. UDP, 27-28.                          tuning, 224.
  25561. Urlichs, Matthias, 30.            remote system, 203-209.
  25562. Usenet, 299.                      restrict
  25563.   maps, 238, 242.                    call time, 207.
  25564. User  Datagram Protocol, see         command execution, 214.
  25565. UDP27.                               file transfer, 214.
  25566. uucico, 195.                         forwarding, 216.
  25567. UUCP, 18-20, 71, 191-229.         retry interval, 208.
  25568.   accounts, 217.                  set up logins, 217-219.
  25569.   alternates, 207.                slave, 194.
  25570.   and getty, 217.                 spool directory, 193.
  25571.   anonymous, 221.                 spool grade, 193, 208-209.
  25572.   BNU, 191.                       statistics, 228.
  25573.   call sequence check,  194,      sys file, 203.
  25574. 220-221.                          Taylor, 191.
  25575.   call time, 207.                 troubleshooting, 225.
  25576.   calling in, 217.                using smail, 248.
  25577.   calling out, 195.               uucico, 194-196.
  25578.   chat scripts, 205-207.          Version 2, 191.
  25579.   checking, 202, 226.           uugetty, 217.
  25580.   command execution, 214.       uux, 315.
  25581.   config file, 202.
  25582.   configuration       files,
  25583. 196-199.
  25584.   configure    as    server,
  25585. 217-222.                                     V
  25586.   device, 204, 209-211.
  25587.   dial file, 211.
  25588.   dialcode file, 204.           Van Jacobson header compres-
  25589.   direct lines, 213.            sion, 124, 136.
  25590.   file transfer, 214.           checkgroups  controlmessage,
  25591.   forwarding, 19, 216.          324.
  25592.   handshake, 194.               Virtual Brewery, 79.
  25593.   HDB, 191, 229.
  25594.   hostname, 200, 202, 203.
  25595.   job, 193.
  25596.   logging   and   debugging,
  25597. 195, 228-229.                                W
  25598.   logging in, 200, 205.
  25599.   login chat, 205.
  25600.   login security, 219-221.      Welsh, Matt, 8.
  25601.   mail, 214, 234, 238.          Wirzenius, Lars, 8.
  25602.   Mapping Project, 201, 238.    wrapper, TCP, 156.
  25603.   maps, 242.
  25604.   master, 194.
  25605.   modem, 209, 211-212.
  25606.   news, 214, 304.
  25607.   over TCP/IP, 212.                          X
  25608.   passwd file, 218.
  25609.   phone number, 204.
  25610.   port file, 209.               X.25, 24.
  25611.   priorities,  193, 208-209.    XDR, see External Data  Rep-
  25612.   protocol, 194, 222-225.       resentation161.
  25613.  
  25614.  
  25615.  
  25616.  
  25617.  
  25618.  
  25619.  
  25620.  
  25621.                            - 388 -
  25622.  
  25623.  
  25624.  
  25625.              Y
  25626.  
  25627.  
  25628. Ye Olde ARPANET kludge, 236.
  25629. Yellow Pages, see NIS166.
  25630. YP, see NIS166.
  25631. yp-linux, 166.
  25632. yp.conf, 173-174.
  25633. ypbind, 169.
  25634. ypcat, 168, 174.
  25635. yps, 166.
  25636. ypserv, 169.
  25637. Yutaka, Niibe, 70.
  25638.  
  25639.  
  25640.  
  25641.  
  25642.              Z
  25643.  
  25644.  
  25645. Zen, 299.
  25646. zone, DNS, see DNS,  zone49.
  25647.  
  25648.  
  25649.  
  25650.  
  25651.  
  25652.  
  25653.  
  25654.  
  25655.  
  25656.  
  25657.  
  25658.  
  25659.  
  25660.  
  25661.  
  25662.  
  25663.  
  25664.  
  25665.  
  25666.  
  25667.  
  25668.  
  25669.  
  25670.  
  25671.  
  25672.  
  25673.  
  25674.  
  25675.  
  25676.  
  25677.  
  25678.  
  25679.  
  25680.  
  25681.  
  25682.  
  25683.  
  25684.  
  25685.  
  25686.  
  25687.                            - 389 -
  25688.  
  25689.  
  25690.  
  25691.  
  25692.  
  25693.  
  25694.  
  25695.  
  25696.  
  25697.  
  25698.  
  25699.  
  25700.  
  25701.  
  25702.  
  25703.  
  25704.  
  25705.  
  25706.  
  25707.  
  25708.  
  25709.  
  25710.  
  25711.  
  25712.  
  25713.  
  25714.  
  25715.  
  25716.  
  25717.  
  25718.  
  25719.  
  25720.  
  25721.  
  25722.  
  25723.  
  25724.  
  25725.  
  25726.  
  25727.  
  25728.  
  25729.  
  25730.  
  25731.  
  25732.  
  25733.  
  25734.  
  25735.  
  25736.  
  25737.  
  25738.  
  25739.  
  25740.  
  25741.  
  25742.  
  25743.  
  25744.  
  25745.  
  25746.  
  25747.  
  25748.  
  25749.  
  25750.  
  25751.  
  25752.  
  25753.  
  25754.  
  25755.  
  25756.  
  25757.                           CONTENTS
  25758.  
  25759.  
  25760.  
  25761. Preface .................................................. 7
  25762.     Documentation on Linux ............................... 8
  25763.     About This Book ...................................... 9
  25764.     The Official Printed Version ........................ 10
  25765.     More Information .................................... 11
  25766.     Thanks .............................................. 12
  25767.     Typographical Conventions ........................... 14
  25768.     The Linux Documentation Project ..................... 15
  25769.     Filesystem Standards ................................ 16
  25770.  
  25771. 2.  Introduction to Networking .......................... 17
  25772.     2.1   History ....................................... 17
  25773.     2.2   UUCP Networks ................................. 18
  25774.     2.3   TCP/IP Networks ............................... 20
  25775.     2.4   Linux Networking .............................. 29
  25776.     2.5   Maintaining Your System ....................... 31
  25777.     2.6   Outlook on the Following Chapters ............. 34
  25778.  
  25779. 3.  Issues of TCP/IP Networking ......................... 36
  25780.     3.1   Networking Interfaces ......................... 36
  25781.     3.2   IP Addresses .................................. 36
  25782.     3.3   Address Resolution ............................ 38
  25783.     3.4   IP Routing .................................... 39
  25784.     3.5   The Internet Control Message Protocol ......... 45
  25785.     3.6   The Domain Name System ........................ 46
  25786.  
  25787. 4.  Configuring the Networking Hardware ................. 57
  25788.     4.1   Devices, Drivers, and all that ................ 57
  25789.     4.2   Kernel Configuration .......................... 59
  25790.     4.3   A Tour of Linux Network Devices ............... 64
  25791.     4.4   Ethernet Installation ......................... 65
  25792.     4.5   The PLIP Driver ............................... 69
  25793.     4.6   The SLIP and PPP Drivers ...................... 70
  25794.  
  25795. 5.  Setting up the Serial Hardware ...................... 71
  25796.     5.1   Communication Software for Modem Links ........ 71
  25797.     5.2   Introduction to Serial Devices ................ 72
  25798.     5.3   Accessing Serial Devices ...................... 73
  25799.     5.4   Serial Hardware ............................... 74
  25800.  
  25801. 6.  Configuring TCP/IP Networking ....................... 77
  25802.     6.1   Setting up the proc Filesystem ................ 77
  25803.     6.2   Installing the Binaries ....................... 78
  25804.     6.3   Another Example ............................... 79
  25805.     6.4   Setting the Hostname .......................... 79
  25806.     6.5   Assigning IP Addresses ........................ 80
  25807.     6.6   Writing hosts and networks Files .............. 81
  25808.     6.7   Interface Configuration for IP ................ 83
  25809.     6.8   All About ifconfig ............................ 93
  25810.  
  25811.  
  25812.  
  25813.                               i
  25814.  
  25815.  
  25816.  
  25817.  
  25818.  
  25819.  
  25820.  
  25821.  
  25822.  
  25823.     6.9   Checking with netstat ......................... 96
  25824.     6.10  Checking the ARP Tables ...................... 100
  25825.     6.11  The Future ................................... 102
  25826.  
  25827. 7.  Name Service and Resolver Configuraton ............. 103
  25828.     7.1   The Resolver Library ......................... 103
  25829.     7.2   Running named ................................ 107
  25830.  
  25831. 8.  Serial Line IP ..................................... 123
  25832.     8.1   General Requirements ......................... 123
  25833.     8.2   SLIP Operation ............................... 124
  25834.     8.3   Using dip .................................... 126
  25835.     8.4   Running in Server Mode ....................... 132
  25836.  
  25837. 9.  The Point-to-Point Protocol ........................ 135
  25838.     9.1   Untangling the P's ........................... 135
  25839.     9.2   PPP on Linux ................................. 136
  25840.     9.3   Running pppd ................................. 137
  25841.     9.4   Using Options Files .......................... 138
  25842.     9.5   Dialing out with chat ........................ 139
  25843.     9.6   Debugging Your PPP Setup ..................... 142
  25844.     9.7   IP Configuration Options ..................... 142
  25845.     9.8   Link Control Options ......................... 145
  25846.     9.9   General Security Considerations .............. 147
  25847.     9.10  Authentication with PPP ...................... 148
  25848.     9.11  Configuring a PPP Server ..................... 152
  25849.  
  25850. 10. Various Network Applications ....................... 154
  25851.     10.1  The inetd Super-Server ....................... 154
  25852.     10.2  The tcpd access control facility ............. 156
  25853.     10.3  The services and protocols Files ............. 159
  25854.     10.4  Remote Procedure Call ........................ 161
  25855.     10.5  Configuring the r Commands ................... 162
  25856.  
  25857. 11. The Network Information System ..................... 166
  25858.     11.1  Getting Acquainted with NIS .................. 167
  25859.     11.2  NIS versus NIS+ .............................. 170
  25860.     11.3  The Client Side of NIS ....................... 170
  25861.     11.4  Running a NIS Server ......................... 171
  25862.     11.5  Setting up a NIS Client with NYS ............. 173
  25863.     11.6  Choosing the Right Maps ...................... 174
  25864.     11.7  Using the passwd and group Maps .............. 176
  25865.     11.8  Using NIS with Shadow Support ................ 179
  25866.     11.9  Using the Traditional NIS Code ............... 179
  25867.  
  25868. 12. The Network File System ............................ 181
  25869.     12.1  Preparing NFS ................................ 183
  25870.     12.2  Mounting an NFS Volume ....................... 183
  25871.     12.3  The NFS Daemons .............................. 186
  25872.     12.4  The exports File ............................. 187
  25873.     12.5  The Linux Automounter ........................ 189
  25874.  
  25875. 13. Managing Taylor UUCP ............................... 191
  25876.  
  25877.  
  25878.  
  25879.                              ii
  25880.  
  25881.  
  25882.  
  25883.  
  25884.  
  25885.  
  25886.  
  25887.  
  25888.  
  25889.     13.1  History ...................................... 191
  25890.     13.2  Introduction ................................. 193
  25891.     13.3  UUCP Configuration Files ..................... 196
  25892.     13.4  The Do's and Dont's of UUCP -- Tuning Permis-
  25893.           sions ........................................ 214
  25894.     13.5  Setting up your System for Dialing in ........ 217
  25895.     13.6  UUCP Low-Level Protocols ..................... 222
  25896.     13.7  Troubleshooting .............................. 225
  25897.     13.8  Log Files .................................... 228
  25898.  
  25899. 14. Electronic Mail .................................... 230
  25900.     14.1  What is a Mail Message? ...................... 231
  25901.     14.2  How is Mail Delivered? ....................... 234
  25902.     14.3  Email Addresses .............................. 235
  25903.     14.4  How does Mail Routing Work? .................. 236
  25904.     14.5  Pathalias and Map File Format ................ 241
  25905.     14.6  Configuring elm .............................. 244
  25906.  
  25907. 15. Getting smail Up and Running ....................... 247
  25908.     15.1  UUCP Setup ................................... 248
  25909.     15.2  Setup for a LAN .............................. 250
  25910.     15.3  If You Don't Get Through... .................. 253
  25911.     15.4  Mail Delivery Modes .......................... 255
  25912.     15.5  Miscellaneous config Options ................. 257
  25913.     15.6  Message Routing and Delivery ................. 257
  25914.     15.7  Routing Messages ............................. 258
  25915.     15.8  Delivering Messages to Local Addresses ....... 261
  25916.     15.9  UUCP-based Transports ........................ 265
  25917.     15.10 SMTP-based Transports ........................ 266
  25918.     15.11 Hostname Qualification ....................... 266
  25919.  
  25920. 16. Sendmail+IDA ....................................... 268
  25921.     16.1  Introduction to Sendmail+IDA ................. 268
  25922.     16.2  Configuration Files --- Overview ............. 268
  25923.     16.3  The sendmail.cf File ......................... 269
  25924.     16.4  A Tour of Sendmail+IDA Tables ................ 277
  25925.     16.5  Installing sendmail .......................... 284
  25926.     16.6  Administrivia and Stupid Mail Tricks ......... 291
  25927.     16.7  Mixing and Matching Binary Distributions ..... 296
  25928.     16.8  Where to Get More Information ................ 297
  25929.  
  25930. 17. Netnews ............................................ 298
  25931.     17.1  Usenet History ............................... 298
  25932.     17.2  What is Usenet, Anyway? ...................... 299
  25933.     17.3  How Does Usenet Handle News? ................. 300
  25934.  
  25935. 18. C News ............................................. 303
  25936.     18.1  Delivering News .............................. 303
  25937.     18.2  Installation ................................. 304
  25938.     18.3  The sys file ................................. 307
  25939.     18.4  The active file .............................. 311
  25940.     18.5  Article Batching ............................. 313
  25941.     18.6  Expiring News ................................ 316
  25942.  
  25943.  
  25944.  
  25945.                              iii
  25946.  
  25947.  
  25948.  
  25949.  
  25950.  
  25951.  
  25952.  
  25953.  
  25954.  
  25955.     18.7  Miscellaneous Files .......................... 319
  25956.     18.8  Control Messages ............................. 321
  25957.     18.9  C News in an NFS Environment ................. 324
  25958.     18.10 Maintenance Tools and Tasks .................. 325
  25959.  
  25960. 19. A Description of NNTP .............................. 328
  25961.     19.1  Introduction ................................. 328
  25962.     19.2  Installing the NNTP server ................... 330
  25963.     19.3  Restricting NNTP Access ...................... 330
  25964.     19.4  NNTP Authorization ........................... 332
  25965.     19.5  nntpd Interaction with C News ................ 333
  25966.  
  25967. 20. Newsreader Configuration ........................... 335
  25968.     20.1  tin Configuration ............................ 336
  25969.     20.2  trn Configuration ............................ 337
  25970.     20.3  nn Configuration ............................. 338
  25971.  
  25972. APPENDIX A: A Null Printer Cable for PLIP .............. 341
  25973.  
  25974. APPENDIX B: Sample smail Configuration Files ........... 342
  25975.  
  25976. APPENDIX C: The GNU General Public License ............. 350
  25977.     C.1   Preamble ..................................... 350
  25978.     C.2   Terms and Conditions for Copying, Distribu-
  25979.           tion, and Modification ....................... 351
  25980.     C.3   Appendix: How to Apply These Terms to Your
  25981.           New Programs ................................. 356
  25982.  
  25983. Glossary ............................................... 359
  25984.  
  25985. Annotated Bibliography ................................. 366
  25986.     Books .............................................. 366
  25987.     HOWTOs ............................................. 369
  25988.     RFCs ............................................... 373
  25989.  
  25990.  
  25991.  
  25992.  
  25993.  
  25994.  
  25995.  
  25996.  
  25997.  
  25998.  
  25999.  
  26000.  
  26001.  
  26002.  
  26003.  
  26004.  
  26005.  
  26006.  
  26007.  
  26008.  
  26009.  
  26010.  
  26011.                              iv
  26012.  
  26013.  
  26014.  
  26015.  
  26016.  
  26017.  
  26018.  
  26019.  
  26020.  
  26021.                         LIST OF FIGURES
  26022.  
  26023.  
  26024.  
  26025.              Figure 1.   The three steps of sending a data-
  26026.            .gram.from.erdos.to.quark... 25
  26027.  
  26028.              Figure 2.   Subnetting a class B network  .. 40
  26029.  
  26030.              Figure 3.   A part of the net topology at Grou-
  26031.           ..cho.Marx.Univ... 42
  26032.  
  26033.              Figure 4.   A part of the domain name space
  26034.             . 47
  26035.  
  26036.              Figure 5.   An excerpt from the named.hosts
  26037.             file.for.the.Physics.Department... 52
  26038.  
  26039.              Figure 6.   An excerpt from the named.hosts
  26040.             file.for.GMU... 52
  26041.  
  26042.              Figure 7.   An excerpt from the named.rev file
  26043.          ...for.subnet.12... 54
  26044.  
  26045.              Figure 8.   An excerpt from the named.rev file
  26046.          ...for.network.149.76... 54
  26047.  
  26048.              Figure 9.   The named.boot file for vlager.
  26049.            .. 108
  26050.  
  26051.             Figure 10.   The named.ca file.  ........... 116
  26052.  
  26053.             Figure 11.   The named.hosts file.  ........ 116
  26054.  
  26055.             Figure 12.   The named.local file.  ........ 116
  26056.  
  26057.             Figure 13.   The named.rev file.  .......... 116
  26058.  
  26059.             Figure 14.   A sample dip script  .......... 126
  26060.  
  26061.             Figure 15.   A sample /etc/inetd.conf file.
  26062.             . 156
  26063.  
  26064.             Figure 16.   A sample /etc/rpc file.  ...... 162
  26065.  
  26066.             Figure 17.   Sample nsswitch.conf file.  ... 176
  26067.  
  26068.             Figure 18.   Interaction of Taylor UUCP Configu-
  26069.          ...ration.Files... 198
  26070.  
  26071.             Figure 19.   sendmail Support Files.  ...... 269
  26072.  
  26073.             Figure 20.   A sample sendmail.m4 file for
  26074.             vstout... 270
  26075.  
  26076.  
  26077.                               v
  26078.  
  26079.  
  26080.  
  26081.  
  26082.  
  26083.  
  26084.  
  26085.  
  26086.  
  26087.             Figure 21.   Usenet news flow through Groucho
  26088.           ..Marx.University... 300
  26089.  
  26090.             Figure 22.   News flow through relaynews.  . 304
  26091.  
  26092.  
  26093.  
  26094.  
  26095.  
  26096.  
  26097.  
  26098.  
  26099.  
  26100.  
  26101.  
  26102.  
  26103.  
  26104.  
  26105.  
  26106.  
  26107.  
  26108.  
  26109.  
  26110.  
  26111.  
  26112.  
  26113.  
  26114.  
  26115.  
  26116.  
  26117.  
  26118.  
  26119.  
  26120.  
  26121.  
  26122.  
  26123.  
  26124.  
  26125.  
  26126.  
  26127.  
  26128.  
  26129.  
  26130.  
  26131.  
  26132.  
  26133.  
  26134.  
  26135.  
  26136.  
  26137.  
  26138.  
  26139.  
  26140.  
  26141.  
  26142.  
  26143.                              vi
  26144.  
  26145.  
  26146.  
  26147.  
  26148.  
  26149.  
  26150.  
  26151.  
  26152.  
  26153.                              LIST OF TABLES
  26154.  
  26155.  
  26156.  
  26157.           TABLE 1.   Some standard NIS maps and the corre-
  26158.          .sponding.files... 167
  26159.  
  26160.  
  26161.  
  26162.  
  26163.  
  26164.  
  26165.  
  26166.  
  26167.  
  26168.  
  26169.  
  26170.  
  26171.  
  26172.  
  26173.  
  26174.  
  26175.  
  26176.  
  26177.  
  26178.  
  26179.  
  26180.  
  26181.  
  26182.  
  26183.  
  26184.  
  26185.  
  26186.  
  26187.  
  26188.  
  26189.  
  26190.  
  26191.  
  26192.  
  26193.  
  26194.  
  26195.  
  26196.  
  26197.  
  26198.  
  26199.  
  26200.  
  26201.  
  26202.  
  26203.  
  26204.  
  26205.  
  26206.  
  26207.  
  26208.  
  26209.                              vii
  26210.  
  26211.  
  26212.